# ---------- Build Stage ---------- FROM golang:1.24-alpine AS builder # Set working directory WORKDIR /app # Install dependencies RUN apk add --no-cache git # Cache and install Go modules COPY go.mod go.sum ./ RUN go mod download # Copy the source code COPY . . # Build the Go binary RUN go build -o server . # ---------- Final Stage ---------- FROM alpine:latest # Install timezone data (optional) RUN apk add --no-cache tzdata ca-certificates # Set working directory WORKDIR /root/ # Copy binary from builder COPY --from=builder /app/server . # Copy binary from builder COPY --from=builder /app/model.conf . # Run the binary CMD ["./server"]