[Bug] Dockerfile suppresses frontend build errors and serves broken unbundled HTML #1

Open
opened 2026-10-14 10:21:37 +00:00 by indrajeet · 0 comments

Summary

In docker/Dockerfile.frontend, the build command swallows build failures:
RUN npm run build || (mkdir -p dist && cp index.html dist/index.html)

When npm run build fails (due to TypeScript or bundling errors), Docker continues building and copies the raw development index.html to /usr/share/nginx/html.

Impact

  • Container boots up and returns HTTP 200 for / and /src/main.tsx (via Nginx SPA fallback).
  • Browser fails parsing HTML as JavaScript (Unexpected token '<'), displaying a blank white screen with no container-level errors in logs.

Steps to Reproduce

  1. Introduce any TypeScript error into frontend/src/.
  2. Run docker compose -f docker-compose.prod.yaml build frontend.
  3. Notice the build succeeds.
  4. Open the web portal in a browser; observe a blank screen.

Expected Behavior

The Docker build step must fail immediately if npm run build exits with a non-zero code.

### Summary In `docker/Dockerfile.frontend`, the build command swallows build failures: `RUN npm run build || (mkdir -p dist && cp index.html dist/index.html)` When `npm run build` fails (due to TypeScript or bundling errors), Docker continues building and copies the raw development `index.html` to `/usr/share/nginx/html`. ### Impact - Container boots up and returns HTTP 200 for `/` and `/src/main.tsx` (via Nginx SPA fallback). - Browser fails parsing HTML as JavaScript (`Unexpected token '<'`), displaying a blank white screen with no container-level errors in logs. ### Steps to Reproduce 1. Introduce any TypeScript error into `frontend/src/`. 2. Run `docker compose -f docker-compose.prod.yaml build frontend`. 3. Notice the build succeeds. 4. Open the web portal in a browser; observe a blank screen. ### Expected Behavior The Docker build step must fail immediately if `npm run build` exits with a non-zero code.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: prashant/c_agri_trade#1
No description provided.