-
Notifications
You must be signed in to change notification settings - Fork 0
Optimize API and dashboard Docker images — remove workspace bloat #32
Copy link
Copy link
Open
Labels
docker_composePull requests that update docker_compose codePull requests that update docker_compose codeenhancementNew feature or requestNew feature or request
Description
Priority: P1
Source
Senior Architect Code Review (2026-04-03)
Problem
The API and dashboard production Dockerfiles use COPY --from=build /app /app which copies the entire workspace into the runner stage — including node_modules, all source files, build artifacts, and test files. This results in unnecessarily large production images (potentially hundreds of MB of dead weight).
Affected Files
apps/api/Dockerfileapps/dashboard/Dockerfile
Current Pattern
# API Dockerfile - runner stage
FROM docker.io/oven/bun:1.3.11 AS runner
WORKDIR /app
COPY --from=build /app /app # <-- copies EVERYTHINGRecommendation
API: Copy only the runtime files needed:
apps/api/src/(Bun runs TypeScript directly)packages/shared-types/src/node_modules/(or better, usebun install --production)package.jsonfiles
Dashboard: The dashboard builds to static assets. The runner should:
- Copy only
apps/dashboard/dist/andapps/dashboard/server.ts - Install only production dependencies
- Serve the static build via the Express server
Acceptance Criteria
- API runner image contains only runtime-necessary files
- Dashboard runner image contains only the built static assets and server
- Production images use
--productiondependency installation where possible - Image sizes are reduced by at least 50%
- Both services still start and function correctly
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
docker_composePull requests that update docker_compose codePull requests that update docker_compose codeenhancementNew feature or requestNew feature or request