Files
marktvogt.de/backend/deploy/Dockerfile
vikingowl 53d7faae24 fix(helm): guaranteed QoS, config checksum, migration retry limit
- Set resources req=limit (100m/128Mi) for Guaranteed QoS class
- Add ConfigMap checksum annotation to trigger rollouts on config changes
- Add retry limit (60 attempts) to migration init container
- Use TARGETARCH in Dockerfile for multi-arch build support
2026-04-01 23:44:50 +02:00

34 lines
777 B
Docker

FROM golang:1.26-alpine AS builder
RUN apk add --no-cache git ca-certificates
# Install golang-migrate CLI with postgres driver (pure Go, no CGO needed)
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@v4.18.1
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w" -o /api ./cmd/api
FROM alpine:3.21
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
COPY --from=builder /api .
COPY --from=builder /go/bin/migrate /usr/local/bin/migrate
COPY migrations/ ./migrations/
# alpine:3.21 already ships nobody at UID 65534 — matches podSecurityContext.runAsUser
USER nobody:nobody
EXPOSE 8080
ENTRYPOINT ["./api"]