Step 9: Wire Vite build into Dockerfile + final cleanup
Some checks failed
Build and Push Docker Image / build (push) Failing after 16s
Licence Check / Licence compatibility and copyright header verification (push) Failing after 35s
CI / Security audit (push) Successful in 57s
CI / Tests & coverage (push) Successful in 1m10s

- Finalise client/vite.config.js (production-ready vanilla config)
- Add client-build stage to Dockerfile before runtime stage
- Delete public/app.js (replaced by Vite build output)
- All 571 tests passing
- All 9 deliverables from refactor plan complete
This commit is contained in:
2026-05-20 23:39:20 +01:00
parent d03efbf25e
commit 78e954ece1
2 changed files with 32 additions and 19 deletions

View File

@@ -9,6 +9,18 @@ WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN npm ci --omit=dev RUN npm ci --omit=dev
# ---------------------------------------------------------------------------
# Stage 1.5 — client-build: build frontend with Vite
# ---------------------------------------------------------------------------
FROM node:22-alpine AS client-build
WORKDIR /app/client
COPY client/package.json client/package-lock.json ./
RUN npm ci
COPY client/ ./
RUN npm run build
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Stage 2 — runtime image (minimal attack surface) # Stage 2 — runtime image (minimal attack surface)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -33,6 +45,7 @@ COPY --from=deps /app/node_modules ./node_modules
# Copy application source owned by root (read-only at runtime) # Copy application source owned by root (read-only at runtime)
COPY --chown=root:root server/ ./server/ COPY --chown=root:root server/ ./server/
COPY --chown=root:root public/ ./public/ COPY --chown=root:root public/ ./public/
COPY --from=client-build --chown=root:root /app/public/app.js ./public/app.js
COPY --chown=root:root package.json ./ COPY --chown=root:root package.json ./
# Bundled snakeoil certificate for out-of-the-box TLS (self-signed, localhost only). # Bundled snakeoil certificate for out-of-the-box TLS (self-signed, localhost only).
# Mount your own cert/key over /app/certs/ or set TLS_CERT/TLS_KEY env vars. # Mount your own cert/key over /app/certs/ or set TLS_CERT/TLS_KEY env vars.

File diff suppressed because one or more lines are too long