Files
tmpl-test-go/Dockerfile
Scaffolder e868792eda
All checks were successful
Build and Push to ACR / Platform guard (push) Successful in 5s
Build and Push to ACR / Build and Push (push) Has been skipped
initial commit
Change-Id: Ied1b5f2137f2b5f803d5411235607bd27c5e57ba
2026-03-24 10:43:21 +00:00

21 lines
472 B
Docker

# ---- Build stage ----
FROM golang:1.22-alpine AS build
WORKDIR /src
COPY go.mod go.sum* ./
RUN go mod tidy && go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /app .
# ---- Runtime stage (distroless) ----
FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /app /app
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD ["/app", "-health-check"]
ENTRYPOINT ["/app"]