142 lines
3.4 KiB
YAML
142 lines
3.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Backend service
|
|
backend:
|
|
build:
|
|
context: ../SerpentRace_Backend
|
|
dockerfile: ../SerpentRace_Docker/Dockerfile_backend
|
|
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
|
|
volumes:
|
|
- ../SerpentRace_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 with nginx
|
|
frontend:
|
|
build:
|
|
context: ../SerpentRace_Frontend
|
|
dockerfile: ../SerpentRace_Docker/Dockerfile_frontend
|
|
container_name: serpentrace-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
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
|
|
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
|
|
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
|
|
|
|
networks:
|
|
serpentrace-network:
|
|
driver: bridge
|