ci(iam): build and push the key-rotation-controller image
Dockerfile: static binary on distroless, no shell, user 65532. Workflow runs on the golang runner for a push to main that touches the controller. It builds two tags, the commit sha and 0.1.0, which is the tag the Deployment asks for, and runs the image with --help so a broken binary fails the job instead of the cluster. The runners were dead before this: every task fetch logged 'lookup forgejo-gitea-http.cicd.svc.cluster.local: no such host'. DNS resolved from a fresh pod and the Service had a healthy endpoint, so the runner pods held stale network state. A rollout restart cleared it and all three poll without error.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
# Build stage. The controller has no cgo and no runtime assets, so the final image
|
||||
# is a static binary on a base with no shell.
|
||||
FROM golang:1.26 AS build
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/controller .
|
||||
|
||||
FROM gcr.io/distroless/static:nonroot
|
||||
COPY --from=build /out/controller /usr/local/bin/controller
|
||||
USER 65532:65532
|
||||
ENTRYPOINT ["/usr/local/bin/controller"]
|
||||
Reference in New Issue
Block a user