Multi-stage Dockerfile builds the Vite app in Node 22 and serves static assets from nginx:alpine. Includes gzip compression, SPA fallback routing, immutable cache headers for hashed assets, and configurable port mapping (default 8080). Deploy with `docker compose up -d`.
1.1 KiB
1.1 KiB
Why
The app currently has no deployment configuration — it can only be run via npm run dev or npm run preview. Adding Docker Compose enables reproducible, single-command deployment to any host with Docker installed.
What Changes
- Add a multi-stage Dockerfile that builds the Vite app and serves the static output with nginx
- Add a docker-compose.yml for single-command deployment (
docker compose up) - Add an nginx configuration for serving the SPA (with client-side routing fallback)
- Add a .dockerignore to keep the image lean
Capabilities
New Capabilities
docker-deployment: Dockerfile, docker-compose.yml, nginx config, and .dockerignore for building and serving the static app
Modified Capabilities
Impact
- New files:
Dockerfile,docker-compose.yml,nginx.conf,.dockerignoreat project root - Dependencies: Requires Docker and Docker Compose on the deployment host
- Existing workflow: No changes to dev workflow (
npm run devstill works as-is) - Build: Vite build runs inside Docker — no host-side Node.js required for deployment