From ed8ff46c9c7e616351fcf8ec07061de55447974d Mon Sep 17 00:00:00 2001 From: Antti Kettunen Date: Tue, 7 Apr 2026 20:32:14 +0300 Subject: [PATCH] Build webui assets in multi-stage Docker image Add a Node-based webui builder stage that installs frontend dependencies and runs the Vite production build, then copies the generated static/dist assets into the final runtime image. Move Python dependency installation into a separate venv build stage so compiler and development packages stay out of the runtime image. Also ignore local webui node_modules, Vite cache, and dist output from the Docker build context. --- .dockerignore | 5 +++++ Dockerfile | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/.dockerignore b/.dockerignore index c3344205..f509ffaa 100644 --- a/.dockerignore +++ b/.dockerignore @@ -25,6 +25,11 @@ __pycache__/ dist/ build/ +# Frontend build artifacts and local dependency caches +webui/node_modules/ +webui/.vite/ +webui/static/dist/ + # Virtual environments venv/ env/ diff --git a/Dockerfile b/Dockerfile index 1e2d77b9..a225b8b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,16 @@ # SoulSync WebUI Dockerfile # Multi-architecture support for AMD64 and ARM64 +FROM node:24-slim AS webui-builder + +WORKDIR /app/webui + +COPY webui/package.json webui/package-lock.json ./ +RUN npm ci + +COPY webui/ ./ +RUN npm run build + # Stage 1: Builder — install Python dependencies with compilation tools FROM python:3.11-slim AS builder @@ -54,6 +64,7 @@ RUN useradd --create-home --shell /bin/bash --uid 1000 soulsync # in tools/), it gets counted twice in the image. Cin caught this on # 2026-05-08 — see the .dockerignore comment for the same incident. COPY --chown=soulsync:soulsync . . +COPY --chown=soulsync:soulsync --from=webui-builder /app/webui/static/dist /app/webui/static/dist # Create runtime mount-point directories the app expects to exist. # NOTE: /app/data is for database FILES, /app/database is the Python package