mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 10:33:40 +01:00
Recompose the Node 24 Alpine and Alpine 3.24 digest-only inputs from managed proposals 4527 (9f3df10976) and 4528 (7ee8c25695). Advance the shared expected-digest constants and integration seed default with all Dockerfile consumers; preserve immutable references, governed tag lines and existing strict alignment assertions. The independent proposal runtime-packaging and provider-startup checks passed; containing checks for this coherent source remain required. Contract-Neutral: Immutable image digest refresh and exact consuming-test/default alignment only; governed Node 24, Go 1.26.11 and Alpine 3.24 lines, build instructions, payload contracts, entrypoints, healthchecks, credentials, installed-state handling and UI source are unchanged. Change-source: pulse-maintainer
65 lines
3.6 KiB
Docker
65 lines
3.6 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM --platform=linux/amd64 node:24-alpine@sha256:116b800c3754b440ee0aa3ed2f20f5bf3d99a554bfd9adeea09ea8017f6e85f5 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.11-alpine@sha256:ae52b5bc6ed045a9ed26ab03dc19327a802a9cc9aa8b27ed57f5c6b60579b0bb 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:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf 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
|