rhythm-backend/Dockerfile
Dmitri cb5d273951
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m25s
go
2026-04-19 16:54:12 +02:00

20 lines
422 B
Docker

FROM golang:1.26-bookworm AS builder
WORKDIR /src
# Cache deps first
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags="-s -w" -o /out/api ./cmd/api
# Small runtime image
FROM gcr.io/distroless/static-debian12
WORKDIR /app
COPY --from=builder /out/api /app/api
EXPOSE 8080
USER nonroot:nonroot
ENTRYPOINT ["/app/api"]