From e3dba105a7a3e1d2bae42f14342be1ea1974e7e4 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sat, 4 Jul 2026 14:46:53 +0100 Subject: [PATCH] Build control-plane image with embedded frontend assets --- deploy/provider-msp/Dockerfile.control-plane | 13 +++++++++++++ scripts/installtests/provider_msp_deploy_test.go | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/deploy/provider-msp/Dockerfile.control-plane b/deploy/provider-msp/Dockerfile.control-plane index 2577aeeb6..0f3b32faf 100644 --- a/deploy/provider-msp/Dockerfile.control-plane +++ b/deploy/provider-msp/Dockerfile.control-plane @@ -1,5 +1,17 @@ # syntax=docker/dockerfile:1.7 +FROM --platform=linux/amd64 node:20-alpine@sha256:fb4cd12c85ee03686f6af5362a0b0d56d50c58a04632e6c0fb8363f609372293 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.25.11-alpine@sha256:8d95af53d0d58e1759ddb4028285d9b1239067e4fbf4f544618cad0f60fbc354 AS builder ARG VERSION=dev ARG BUILD_TIME=unknown @@ -16,6 +28,7 @@ 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 \ diff --git a/scripts/installtests/provider_msp_deploy_test.go b/scripts/installtests/provider_msp_deploy_test.go index 6b6b74054..a94805c5b 100644 --- a/scripts/installtests/provider_msp_deploy_test.go +++ b/scripts/installtests/provider_msp_deploy_test.go @@ -266,6 +266,9 @@ func TestProviderMSPControlPlaneDockerfileBuildsReleaseLicenseBinary(t *testing. text := string(dockerfileBytes) assertContainsAll(t, text, "# syntax=docker/dockerfile:1.7", + "FROM --platform=linux/amd64 node:20-alpine@sha256:fb4cd12c85ee03686f6af5362a0b0d56d50c58a04632e6c0fb8363f609372293 AS frontend-builder", + "npm ci", + "npm run build", "FROM --platform=$BUILDPLATFORM golang:1.25.11-alpine@sha256:8d95af53d0d58e1759ddb4028285d9b1239067e4fbf4f544618cad0f60fbc354 AS builder", "FROM alpine:3.20@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc", "ARG PULSE_LICENSE_PUBLIC_KEY_SHA256", @@ -277,6 +280,7 @@ func TestProviderMSPControlPlaneDockerfileBuildsReleaseLicenseBinary(t *testing. `LICENSE_PUBLIC_KEY="$(tr -d '\r\n' < /run/secrets/pulse_license_public_key)"`, "mounted license public key must decode to 32 bytes.", "mounted license public key does not match PULSE_LICENSE_PUBLIC_KEY_SHA256.", + "COPY --from=frontend-builder /app/internal/api/frontend-modern/dist ./internal/api/frontend-modern/dist", `TARGET_GOOS="${TARGETOS:-linux}"`, `TARGET_GOARCH="${TARGETARCH:-$(go env GOARCH)}"`, `./scripts/release_ldflags.sh server --version "${VERSION}" --build-time "${BUILD_TIME}" --git-commit "${GIT_COMMIT}" --license-public-key "${LICENSE_PUBLIC_KEY}"`,