File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1
1
# our data dir used for downloading and processing
2
2
data /
3
3
4
+ # load config
5
+ config /geocodeur.load.conf
6
+
4
7
# build binaries
5
8
main
6
9
geocodeur
Original file line number Diff line number Diff line change
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"]
You can’t perform that action at this time.
0 commit comments