- Add frontend Dockerfile with multi-stage build using node and nginx - Add backend Dockerfile with multi-stage build to compile and serve app - Add docker-compose.yml to define frontend and backend services with environment variables - Configure nginx to serve SPA, enable gzip compression and caching for static assets - Set up nginx reverse proxy for API requests to backend service on /api path
29 lines
652 B
YAML
29 lines
652 B
YAML
version: '3.8'
|
|
|
|
services:
|
|
frontend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "80:80"
|
|
depends_on:
|
|
- backend
|
|
environment:
|
|
- VITE_MS_CLIENT_ID=${VITE_MS_CLIENT_ID}
|
|
- VITE_GOOGLE_CLIENT_ID=${VITE_GOOGLE_CLIENT_ID}
|
|
|
|
backend:
|
|
build:
|
|
context: ./server
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "3001:3001"
|
|
environment:
|
|
- PORT=3001
|
|
- VITE_MS_CLIENT_ID=${VITE_MS_CLIENT_ID}
|
|
- MS_CLIENT_SECRET=${MS_CLIENT_SECRET}
|
|
- VITE_GOOGLE_CLIENT_ID=${VITE_GOOGLE_CLIENT_ID}
|
|
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
|
|
- REDIRECT_URI=${REDIRECT_URI}
|