Files
Pulse/deploy/provider-msp/Dockerfile.control-plane
pulse-triage[bot] 8f1bd0b10d Refresh governed Node and Go container build inputs together
Reconcile the two digest-only dependency proposals on current main, retaining Node 24, Go 1.26.10 and all runtime bases. Update the exact pin proofs and bind the server, provider control plane, integration mock and distinct devcontainer image to the module compiler so a partial refresh cannot silently diverge.

Change-source: pulse-maintainer
2026-11-03 04:45:49 +00:00

65 lines
3.6 KiB
Docker

# syntax=docker/dockerfile:1.7
FROM --platform=linux/amd64 node:24-alpine@sha256:8a32c8cf649a49915a66e81e7a609223c708d0adabf288ee3f4077d765542f85 AS frontend-builder
WORKDIR /app/frontend-modern
COPY frontend-modern/package*.json ./
RUN --mount=type=cache,id=pulse-control-plane-npm-cache,target=/root/.npm \
npm ci
COPY frontend-modern/ ./
COPY scripts/exclusive-lock.mjs /app/scripts/exclusive-lock.mjs
COPY docs/ /app/docs/
COPY SECURITY.md TERMS.md /app/
RUN --mount=type=cache,id=pulse-control-plane-npm-cache,target=/root/.npm \
npm run build
FROM --platform=$BUILDPLATFORM golang:1.26.10-alpine@sha256:a2012b4a1d1f9f7e9f44e0d39b805a901e856b1dd80b4e6ee4338db547050308 AS builder
ARG VERSION=dev
ARG BUILD_TIME=unknown
ARG GIT_COMMIT=unknown
ARG TARGETOS
ARG TARGETARCH
ARG PULSE_LICENSE_PUBLIC_KEY_SHA256
WORKDIR /src
COPY go.mod go.sum ./
RUN --mount=type=cache,id=pulse-control-plane-go-mod,target=/go/pkg/mod \
--mount=type=cache,id=pulse-control-plane-go-build,target=/root/.cache/go-build \
go mod download
COPY cmd/ ./cmd/
COPY internal/ ./internal/
COPY pkg/ ./pkg/
COPY scripts/release_ldflags.sh ./scripts/release_ldflags.sh
COPY --from=frontend-builder /app/internal/api/frontend-modern/dist ./internal/api/frontend-modern/dist
RUN --mount=type=cache,id=pulse-control-plane-go-mod,target=/go/pkg/mod \
--mount=type=cache,id=pulse-control-plane-go-build,target=/root/.cache/go-build \
--mount=type=secret,id=pulse_license_public_key,required=false \
set -eu; \
EXPECTED_LICENSE_PUBLIC_KEY_SHA256="${PULSE_LICENSE_PUBLIC_KEY_SHA256#SHA256:}"; \
if [ -z "${EXPECTED_LICENSE_PUBLIC_KEY_SHA256}" ]; then echo "Error: PULSE_LICENSE_PUBLIC_KEY_SHA256 is required for control-plane release image builds." >&2; exit 1; fi; \
if [ ! -f /run/secrets/pulse_license_public_key ]; then echo "Error: PULSE_LICENSE_PUBLIC_KEY_SHA256 was provided but no license public key was mounted." >&2; exit 1; fi; \
LICENSE_PUBLIC_KEY="$(tr -d '\r\n' < /run/secrets/pulse_license_public_key)"; \
LICENSE_PUBLIC_KEY_BYTES="$(printf '%s' "${LICENSE_PUBLIC_KEY}" | base64 -d | wc -c | tr -d ' ')"; \
if [ "${LICENSE_PUBLIC_KEY_BYTES}" != "32" ]; then echo "Error: mounted license public key must decode to 32 bytes." >&2; exit 1; fi; \
ACTUAL_LICENSE_PUBLIC_KEY_SHA256="$(printf '%s' "${LICENSE_PUBLIC_KEY}" | base64 -d | sha256sum | awk '{print $1}')"; \
if [ "${ACTUAL_LICENSE_PUBLIC_KEY_SHA256}" != "${EXPECTED_LICENSE_PUBLIC_KEY_SHA256}" ]; then echo "Error: mounted license public key does not match PULSE_LICENSE_PUBLIC_KEY_SHA256." >&2; exit 1; fi; \
TARGET_GOOS="${TARGETOS:-linux}"; \
TARGET_GOARCH="${TARGETARCH:-$(go env GOARCH)}"; \
SERVER_LDFLAGS="$(./scripts/release_ldflags.sh server --version "${VERSION}" --build-time "${BUILD_TIME}" --git-commit "${GIT_COMMIT}" --license-public-key "${LICENSE_PUBLIC_KEY}")"; \
CGO_ENABLED=0 GOOS="${TARGET_GOOS}" GOARCH="${TARGET_GOARCH}" go build \
-tags release \
-ldflags="${SERVER_LDFLAGS}" \
-buildvcs=false \
-trimpath \
-o /pulse-control-plane ./cmd/pulse-control-plane
FROM alpine:3.24@sha256:be2656061b536c1883c4034790e21d0a09c5aaaf51968b89368a3c0371ea2c9a AS control-plane-runtime-foundation
RUN apk add --no-cache ca-certificates docker-cli
ENTRYPOINT ["pulse-control-plane"]
FROM control-plane-runtime-foundation AS control_plane_prebuilt
ARG TARGETARCH
COPY --from=compiled_payload /binaries/pulse-control-plane-linux-${TARGETARCH:-amd64} /usr/local/bin/pulse-control-plane
RUN chmod 755 /usr/local/bin/pulse-control-plane
FROM control-plane-runtime-foundation AS runtime
COPY --from=builder /pulse-control-plane /usr/local/bin/pulse-control-plane