BUG: Frontend build/packaging fragility (custom Vite output + incomplete Dockerfile copy) #66

Closed
opened 2026-05-28 11:40:28 +01:00 by Gandalf · 0 comments
Owner

Description:

The frontend build and Docker packaging process (client/vite.config.js + Dockerfile) is fragile and has already caused non-functional UI in v1.7.30. While partially improved in v1.7.31, it remains at risk of regression and does not follow standard practices.

Detailed Investigation Findings (release/1.7.31)

1. Non-Standard Vite Configuration

  • build.outDir: '../public' (instead of standard dist/).
  • Custom rollupOptions.input: { main: './src/main.js' } + forced entryFileNames: 'app.js'.
  • client/index.html still references /src/main.jsx (non-existent file) — the build process must rewrite it, but this is brittle.
  • emptyOutDir: false + committed build artifacts in public/ (index.html, app.js, style.css) create version control and reproducibility problems.

2. Dockerfile Packaging Issues (Improved but Still Fragile)

  • Pre-1.7.31: Only copied /app/public/app.js from client-build stage → missing processed index.html, CSS, and other assets.
  • v1.7.31 fix: Added full public/ copy, but still relies on the custom Vite output being perfect.
  • No clean separation between source client/ and build output.

3. Runtime Serving (server/app.js)

  • Manual index.html patching for CSP nonce + express.static works, but depends on the build producing a correct index.html with the right <script src="/app.js">.

Impact:

  • UI was completely broken in v1.7.30.
  • Any future change to Vite config or build process can silently break the Docker image.
  • Makes local development vs production parity difficult.

Proposed Solution / Fix Plan:

  1. Switch to standard Vite setup: output to dist/, let Vite handle index.html processing normally.
  2. Update Dockerfile:
    • Build stage → COPY --from=client-build /app/dist ./public
    • Remove committed build artifacts from public/.
  3. Update package.json scripts to support npm run build at root level.
  4. Add a CI step that builds the Docker image and smoke-tests the UI (curl + check for expected assets / no console errors).

Cross-Dependencies:

  • A broken frontend affects display of all features (webhooks, queue, Ombi, download clients, SSE). This ticket is a prerequisite for users to actually see fixes from #61 (season packs) and the webhook reliability ticket.

Suggested Labels:
Kind/Bug, Priority: Medium, Area/Frontend, Area/Docker, Compat/Non-Breaking

Affected Versions: v1.7.21 – v1.7.31 (major breakage in 1.7.30).

**Description:** The frontend build and Docker packaging process (`client/vite.config.js` + `Dockerfile`) is fragile and has already caused non-functional UI in v1.7.30. While partially improved in v1.7.31, it remains at risk of regression and does not follow standard practices. ### Detailed Investigation Findings (release/1.7.31) **1. Non-Standard Vite Configuration** - `build.outDir: '../public'` (instead of standard `dist/`). - Custom `rollupOptions.input: { main: './src/main.js' }` + forced `entryFileNames: 'app.js'`. - `client/index.html` still references `/src/main.jsx` (non-existent file) — the build process must rewrite it, but this is brittle. - `emptyOutDir: false` + committed build artifacts in `public/` (index.html, app.js, style.css) create version control and reproducibility problems. **2. Dockerfile Packaging Issues (Improved but Still Fragile)** - Pre-1.7.31: Only copied `/app/public/app.js` from client-build stage → missing processed `index.html`, CSS, and other assets. - v1.7.31 fix: Added full `public/` copy, but still relies on the custom Vite output being perfect. - No clean separation between source `client/` and build output. **3. Runtime Serving (`server/app.js`)** - Manual `index.html` patching for CSP nonce + `express.static` works, but depends on the build producing a correct `index.html` with the right `<script src="/app.js">`. **Impact:** - UI was completely broken in v1.7.30. - Any future change to Vite config or build process can silently break the Docker image. - Makes local development vs production parity difficult. **Proposed Solution / Fix Plan:** 1. Switch to standard Vite setup: output to `dist/`, let Vite handle `index.html` processing normally. 2. Update Dockerfile: - Build stage → `COPY --from=client-build /app/dist ./public` - Remove committed build artifacts from `public/`. 3. Update `package.json` scripts to support `npm run build` at root level. 4. Add a CI step that builds the Docker image and smoke-tests the UI (curl + check for expected assets / no console errors). **Cross-Dependencies:** - A broken frontend affects display of **all** features (webhooks, queue, Ombi, download clients, SSE). This ticket is a prerequisite for users to actually see fixes from #61 (season packs) and the webhook reliability ticket. **Suggested Labels:** Kind/Bug, Priority: Medium, Area/Frontend, Area/Docker, Compat/Non-Breaking **Affected Versions:** v1.7.21 – v1.7.31 (major breakage in 1.7.30).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/sofarr#66