Skip to content

Commit 9fde5c2

Browse files
committed
added Dockerfile for server
1 parent 6ebf9c8 commit 9fde5c2

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Dockerfile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
# Set the environment variables
29+
ENV GEOCODEUR_CONFIG_PATH="/config/geocodeur.conf"
30+
31+
# Copy the Go binary from the builder stage
32+
COPY --from=builder /app/geocodeur /usr/local/bin/geocodeur
33+
34+
# Default port but geocodeur.conf can override it
35+
EXPOSE 8080
36+
37+
# Command to run the server
38+
CMD ["geocodeur", "server"]

0 commit comments

Comments
 (0)