From d9f55df347a1ed6b2be23244f2f03fc60905dc17 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 22 Apr 2026 12:58:29 -0400 Subject: [PATCH] build: multi-stage Dockerfile with node->go->slim for embedded SPA Web assets are built in the node stage, copied into the go stage before go build so //go:embed picks them up, then the minimal slim runtime carries only the final binary and ffmpeg. Co-Authored-By: Claude Opus 4.7 --- Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index ed61cdc7..40b51f31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,19 @@ # syntax=docker/dockerfile:1.6 +FROM node:22-bookworm-slim AS web +WORKDIR /web +COPY web/package.json web/package-lock.json ./ +RUN npm ci +COPY web/ ./ +RUN npm run build + FROM golang:1.23-bookworm AS builder WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . +# Overwrite the committed placeholder with the freshly-built SPA assets. +COPY --from=web /web/build ./web/build ENV CGO_ENABLED=0 RUN go build -trimpath -ldflags="-s -w" -o /out/minstrel ./cmd/minstrel