version: '3.8' services: app: build: context: ./backend dockerfile: Dockerfile ports: - "8002:8001" environment: - DATABASE_URL=postgresql://yuzhiran:yuzhiran@db:5432/yuzhiran_db - REDIS_URL=redis://redis:6379/0 - SECRET_KEY=your-secret-key-change-in-production - ALGORITHM=HS256 - ACCESS_TOKEN_EXPIRE_MINUTES=10080 - DEBUG=False - ENVIRONMENT=production depends_on: - db - redis volumes: - ./backend:/app restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8001/health"] interval: 30s timeout: 10s retries: 3 db: image: postgres:13-alpine environment: POSTGRES_DB: yuzhiran_db POSTGRES_USER: yuzhiran POSTGRES_PASSWORD: yuzhiran POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" volumes: - postgres_data:/var/lib/postgresql/data - ./init.sql:/docker-entrypoint-initdb.d/init.sql ports: - "5433:5432" restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U yuzhiran -d yuzhiran_db"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7-alpine command: redis-server --appendonly yes --requirepass redis123 volumes: - redis_data:/data ports: - "6379:6379" restart: unless-stopped healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 3 nginx: image: nginx:alpine ports: - "8080:80" - "8443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf - ./ssl:/etc/nginx/ssl depends_on: - app restart: unless-stopped frontend: build: context: ./frontend dockerfile: Dockerfile ports: - "8000:8000" volumes: - ./frontend:/usr/share/nginx/html restart: unless-stopped volumes: postgres_data: redis_data: networks: default: driver: bridge