Skip to content

Commit 23b4dda

Browse files
committed
added dockerfile for loading data from image
1 parent 79b251f commit 23b4dda

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# our data dir used for downloading and processing
22
data/
33

4+
# load config
5+
config/geocodeur.load.conf
6+
47
# build binaries
58
main
69
geocodeur

Dockerfile.load

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Stage 1: Build the Go application
2+
FROM golang:1.23.5-bookworm AS builder
3+
4+
# Install necessary packages for building
5+
RUN apt update && apt install -y unzip
6+
7+
# Install DuckDB
8+
RUN curl --fail --location --output duckdb_cli-linux-amd64.zip https://github.com/duckdb/duckdb/releases/download/v1.1.3/duckdb_cli-linux-amd64.zip && unzip duckdb_cli-linux-amd64.zip
9+
10+
# Move the DuckDB binary to the /usr/local/bin directory
11+
RUN mv duckdb /usr/local/bin/duckdb
12+
13+
# Set the working directory inside the container
14+
WORKDIR /app
15+
16+
# Copy the source code
17+
COPY ./src .
18+
19+
# Download dependencies
20+
RUN go mod download
21+
22+
# Build the Go application for production
23+
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -gcflags="-m" -o geocodeur main.go
24+
25+
# Stage 2: Create the final lightweight image
26+
FROM debian:bookworm
27+
28+
# Copy over the config for loading data into the database
29+
COPY ./config/geocodeur.load.conf /config/geocodeur.conf
30+
31+
# Copy over our data to /data
32+
COPY ./data/download/geocodeur_division.geoparquet /data/geocodeur_division.geoparquet
33+
COPY ./data/download/geocodeur_segment.geoparquet /data/geocodeur_segment.geoparquet
34+
COPY ./data/download/geocodeur_water.geoparquet /data/geocodeur_water.geoparquet
35+
COPY ./data/download/geocodeur_poi.geoparquet /data/geocodeur_poi.geoparquet
36+
37+
# Set the environment variables
38+
ENV GEOCODEUR_CONFIG_PATH="/config/geocodeur.conf"
39+
40+
# Copy the Go binary from the builder stage
41+
COPY --from=builder /app/geocodeur /usr/local/bin/geocodeur
42+
43+
# Command to run create
44+
CMD ["geocodeur", "create"]

0 commit comments

Comments
 (0)