version: '3.8' services: # Backend service using pre-built image backend: image: serpentrace_docker-backend:latest container_name: serpentrace-backend restart: unless-stopped ports: - "3000:3000" environment: - NODE_ENV=production - PORT=3000 - DB_HOST=postgres - DB_PORT=5432 - DB_NAME=serpentrace - DB_USERNAME=postgres - DB_PASSWORD=${POSTGRES_PASSWORD} - REDIS_URL=redis://redis:6379 - REDIS_HOST=redis - REDIS_PORT=6379 - JWT_SECRET=${JWT_SECRET} - JWT_EXPIRATION=${JWT_EXPIRATION:-24h} - JWT_REFRESH_EXPIRATION=${JWT_REFRESH_EXPIRATION:-7d} - MINIO_ENDPOINT=minio - MINIO_PORT=9000 - MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY} - MINIO_SECRET_KEY=${MINIO_SECRET_KEY} - MINIO_USE_SSL=false - EMAIL_HOST=${EMAIL_HOST} - EMAIL_PORT=${EMAIL_PORT} - EMAIL_SECURE=${EMAIL_SECURE} - EMAIL_USER=${EMAIL_USER} - EMAIL_PASS=${EMAIL_PASS} - EMAIL_FROM=${EMAIL_FROM} volumes: - backend_logs:/app/logs depends_on: postgres: condition: service_healthy redis: condition: service_healthy minio: condition: service_healthy networks: - serpentrace-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # Frontend service using pre-built image frontend: image: serpentrace_docker-frontend:latest container_name: serpentrace-frontend restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - backend networks: - serpentrace-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 # PostgreSQL Database postgres: image: postgres:15-alpine container_name: serpentrace-postgres restart: unless-stopped ports: - "5432:5432" environment: POSTGRES_DB: serpentrace POSTGRES_USER: postgres POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} POSTGRES_INITDB_ARGS: "--encoding=UTF-8" volumes: - postgres_data:/var/lib/postgresql/data - ./sql_schema_only.sql:/docker-entrypoint-initdb.d/init.sql networks: - serpentrace-network healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 10s timeout: 5s retries: 5 # Redis Cache redis: image: redis:7-alpine container_name: serpentrace-redis restart: unless-stopped ports: - "6379:6379" volumes: - redis_data:/data command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD} networks: - serpentrace-network healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # MinIO Object Storage minio: image: minio/minio:latest container_name: serpentrace-minio restart: unless-stopped ports: - "9000:9000" - "9001:9001" environment: MINIO_ROOT_USER: ${MINIO_ACCESS_KEY} MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY} volumes: - minio_data:/data command: server /data --console-address ":9001" networks: - serpentrace-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 10s timeout: 5s retries: 5 volumes: postgres_data: driver: local redis_data: driver: local minio_data: driver: local backend_logs: driver: local networks: serpentrace-network: driver: bridge