# --- Stage 1: Build the Go application --- FROM golang:1.23 AS builder ENV CGO_ENABLED=0 ENV GOOS=linux ENV GOARCH=amd64 WORKDIR /app # Copy the Go modules and dependencies COPY ./src/go.mod ./src/go.sum ./ RUN go mod download # Copy the source code COPY ./src/cmd ./cmd COPY ./src/assets ./assets COPY ./src/internal ./internal # Build the application RUN go build -o main cmd/frontend/* # --- Stage 2: Run the application --- FROM alpine:latest ENV DB_HOST="10.99.0.3" ENV DB_PORT="5432" ENV DB_NAME="crowsnest" ENV DB_USER="crow" ENV DB_PASS="" WORKDIR /app # Copy the built binary from the builder stage COPY --from=builder /app/main . COPY ./src/assets ./assets EXPOSE 8080 # Command to run the application CMD ["/app/main"]