-
Notifications
You must be signed in to change notification settings - Fork 0
Tech Story: Harden Dockerfiles for production #102
Copy link
Copy link
Open
Labels
backendBackend services and logicBackend services and logicconfigConfiguration and feature flagsConfiguration and feature flagsfrontendFrontend app and dashboardFrontend app and dashboardtech-storyTechnical implementation storyTechnical implementation story
Milestone
Description
Tech Story
As a platform engineer, I want production Docker images to be lean, reproducible, and secure so that deployed containers have minimal attack surface and known-good dependency trees.
Context
Current Dockerfiles have several issues identified in audit:
- Node.js 14 (EOL April 2023 — no security patches)
- No multi-stage build — devDependencies shipped in production image
npm installinstead ofnpm ci— non-reproducible builds- Backend
CMDrunsstart:dev(file-watch dev server) in production COPY . .may copy.envfiles into the image- No non-root user — any RCE gains full container root
- No
HEALTHCHECKinstruction EXPOSEport mismatch with actual runtime port
Acceptance Criteria
- Both images use Node.js 22 LTS (Alpine)
- Multi-stage build: builder installs all deps + compiles; runner installs prod-only deps + copies
dist/ -
npm ciused in both stages for reproducible installs - Backend
CMDrunsnode dist/main.js(orstart:prod) -
.dockerignorepresent for both packages, excluding.env,.git,node_modules, test files, coverage - Non-root user created and switched to before
CMD -
HEALTHCHECKinstruction added (backend:GET /health; frontend: HTTP check on served port) -
EXPOSEport matches actual runtime port from env - Frontend serves static build via
nginx:alpine(notserveorvite preview)
Notes
- A
GET /healthendpoint should be added to the backend (simple 200 OK) if it doesn't already exist - Frontend nginx config should proxy
/apito the backend service (useful for k8s ingress)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
backendBackend services and logicBackend services and logicconfigConfiguration and feature flagsConfiguration and feature flagsfrontendFrontend app and dashboardFrontend app and dashboardtech-storyTechnical implementation storyTechnical implementation story