80 lines
2.0 KiB
YAML
80 lines
2.0 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile.prod
|
|
container_name: nextjs-app-prod
|
|
environment:
|
|
- NODE_ENV=production
|
|
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://your-domain.com}
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- app-network
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile.prod
|
|
container_name: nestjs-app-prod
|
|
environment:
|
|
- NODE_ENV=production
|
|
- DATABASE_URL=postgresql://${POSTGRES_USER:-prod_user}:${POSTGRES_PASSWORD:-CHANGE_THIS_STRONG_PASSWORD}@postgres:5432/${POSTGRES_DB:-prod_db}
|
|
- REDIS_URL=redis://redis:${REDIS_PORT:-6379}
|
|
- JWT_SECRET=${JWT_SECRET:-SUPER_SECURE_JWT_SECRET_AT_LEAST_32_CHARACTERS_LONG}
|
|
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-1h}
|
|
- CORS_ORIGIN=${CORS_ORIGIN:-https://your-domain.com}
|
|
- RATE_LIMIT_WINDOW_MS=${RATE_LIMIT_WINDOW_MS:-900000}
|
|
- RATE_LIMIT_MAX_REQUESTS=${RATE_LIMIT_MAX_REQUESTS:-50}
|
|
depends_on:
|
|
- postgres
|
|
- redis
|
|
networks:
|
|
- app-network
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: postgres-db-prod
|
|
environment:
|
|
- POSTGRES_USER=${POSTGRES_USER:-prod_user}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-CHANGE_THIS_STRONG_PASSWORD}
|
|
- POSTGRES_DB=${POSTGRES_DB:-prod_db}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- app-network
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: redis-cache-prod
|
|
environment:
|
|
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- app-network
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: nginx-proxy-prod
|
|
ports:
|
|
- "${NGINX_HTTP_PORT:-80}:80"
|
|
- "${NGINX_HTTPS_PORT:-443}:443"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
|
- ./nginx/ssl:/etc/nginx/ssl
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
networks:
|
|
- app-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
app-network:
|
|
driver: bridge |