# Ships as one image: the Go binary embeds the built Svelte SPA, so this is # the only container the app itself needs (Postgres and the OIDC provider # already run elsewhere). # --- Stage 1: build the frontend --- FROM node:20-alpine AS frontend-build WORKDIR /frontend COPY frontend/package.json frontend/package-lock.json* ./ RUN npm install COPY frontend/ ./ RUN npm run build # --- Stage 2: build the Go binary, embedding the frontend build --- FROM golang:1.25-alpine AS backend-build WORKDIR /backend COPY backend/go.mod backend/go.sum ./ RUN go mod download COPY backend/ ./ COPY --from=frontend-build /frontend/dist/. ./cmd/server/web/ RUN CGO_ENABLED=0 go build -o /vlog ./cmd/server # --- Stage 3: minimal runtime image --- FROM alpine:3.20 RUN apk add --no-cache ca-certificates COPY --from=backend-build /vlog /vlog EXPOSE 8080 ENTRYPOINT ["/vlog"]