-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 1.09 KB
/
Dockerfile
File metadata and controls
38 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Stage 1: Build the Go application
FROM golang:1.23.5-bookworm AS builder
# Install necessary packages for building
RUN apt update && apt install -y unzip
# Install DuckDB
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
# Move the DuckDB binary to the /usr/local/bin directory
RUN mv duckdb /usr/local/bin/duckdb
# Set the working directory inside the container
WORKDIR /app
# Copy the source code
COPY ./src .
# Download dependencies
RUN go mod download
# Build the Go application for production
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -gcflags="-m" -o geocodeur main.go
# Stage 2: Create the final lightweight image
FROM debian:bookworm
# Set the environment variables
ENV GEOCODEUR_CONFIG_PATH="/config/geocodeur.conf"
# Copy the Go binary from the builder stage
COPY --from=builder /app/geocodeur /usr/local/bin/geocodeur
# Default port but geocodeur.conf can override it
EXPOSE 8080
# Command to run the server
CMD ["geocodeur", "server"]