FROM golang:1.26.6-alpine AS build WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY cmd ./cmd COPY internal ./internal ARG VERSION=dev ARG COMMIT=unknown ARG BUILD_TIME=unknown RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w \ -X data-terminal-cloud/internal/buildinfo.Version=${VERSION} \ -X data-terminal-cloud/internal/buildinfo.Commit=${COMMIT} \ -X data-terminal-cloud/internal/buildinfo.BuildTime=${BUILD_TIME}" -o /out/api ./cmd/api && \ CGO_ENABLED=0 go build -trimpath -ldflags="-s -w \ -X data-terminal-cloud/internal/buildinfo.Version=${VERSION} \ -X data-terminal-cloud/internal/buildinfo.Commit=${COMMIT} \ -X data-terminal-cloud/internal/buildinfo.BuildTime=${BUILD_TIME}" -o /out/callbacks ./cmd/callbacks && \ CGO_ENABLED=0 go build -trimpath -ldflags="-s -w \ -X data-terminal-cloud/internal/buildinfo.Version=${VERSION} \ -X data-terminal-cloud/internal/buildinfo.Commit=${COMMIT} \ -X data-terminal-cloud/internal/buildinfo.BuildTime=${BUILD_TIME}" -o /out/worker ./cmd/worker && \ CGO_ENABLED=0 go build -trimpath -o /out/sim-device ./cmd/sim-device && \ CGO_ENABLED=0 go build -trimpath -o /out/firmware-conformance ./cmd/firmware-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/alert-receiver-conformance ./cmd/alert-receiver-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/kms-rotation-conformance ./cmd/kms-rotation-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/recovery-conformance ./cmd/recovery-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/infrastructure-conformance ./cmd/infrastructure-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/safari-conformance ./cmd/safari-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/rtc-conformance ./cmd/rtc-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/agent-models-conformance ./cmd/agent-models-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/ci-supply-chain-conformance ./cmd/ci-supply-chain-conformance && \ CGO_ENABLED=0 go build -trimpath -o /out/mock-provider ./cmd/mock-provider && \ CGO_ENABLED=0 go build -trimpath -o /out/mock-alert-receiver ./cmd/mock-alert-receiver FROM gcr.io/distroless/static-debian12:nonroot ARG VERSION=dev ARG COMMIT=unknown ARG BUILD_TIME=unknown LABEL org.opencontainers.image.version="${VERSION}" \ org.opencontainers.image.revision="${COMMIT}" \ org.opencontainers.image.created="${BUILD_TIME}" WORKDIR /app COPY --from=build /out/ /app/ EXPOSE 8080 8081 8082 8083 8084 USER nonroot:nonroot ENTRYPOINT ["/app/api"]