- Dockerfile: multi-stage (golang:1.23-alpine3.21 → distroless/static:nonroot), CGO off, trimpath, stripped, UID/GID 65532, read-only rootfs friendly. - deploy/signing-service/: ServiceAccount, Deployment (2 replicas, probes, tight SecurityContext), ClusterIP Service on :8081, NetworkPolicy (ingress from agent-trust, DNS egress), example Secret, and README with the full dev + prod secret convention. - .forgejo/workflows/build-images.yml: builds image on push + PR, pushes :<git-sha> + :main to harbor.basicstack.de on main pushes only. Clone pattern matches validate.yml (sha256 repo, manual git clone). - README updates: service README gains Deployment section; repo README layout now mentions services/signing-service, services/transparency-log, deploy/, and the new workflow. Scope matches DEV-605. OpenBao, OPA and Pocket-ID JWKS stay stubs and move in their own follow-up subtasks; the prod secret shape is documented so those subtasks can plug in without reshaping the Deployment. Co-Authored-By: Paperclip <noreply@paperclip.ing>
41 lines
1.3 KiB
Docker
41 lines
1.3 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# ---------- build ----------
|
|
FROM golang:1.23-alpine3.21 AS build
|
|
|
|
ENV CGO_ENABLED=0 \
|
|
GOOS=linux \
|
|
GOFLAGS="-trimpath"
|
|
|
|
WORKDIR /src
|
|
|
|
# Only the signing-service module is needed. Copy the module files first so
|
|
# the dependency download layer is cacheable independently of source edits.
|
|
COPY services/signing-service/go.mod ./
|
|
# go.sum will be copied in when the module gains external deps; today the
|
|
# module is stdlib-only.
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
go mod download || true
|
|
|
|
COPY services/signing-service/ ./
|
|
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
go vet ./... && \
|
|
go test ./... && \
|
|
go build -ldflags="-s -w" -o /out/signing-service ./cmd/signing-service
|
|
|
|
# ---------- runtime ----------
|
|
# Distroless static+nonroot: no shell, no package manager, UID/GID 65532.
|
|
# gcr.io/distroless/static-debian12:nonroot pins to the latest nonroot
|
|
# variant; CI tags images by git sha so this is reproducible at the point
|
|
# of build.
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
|
|
COPY --from=build /out/signing-service /signing-service
|
|
|
|
USER 65532:65532
|
|
EXPOSE 8081
|
|
ENTRYPOINT ["/signing-service"]
|
|
CMD ["-listen=:8081", "-backend=memory"]
|