version: '3.8' services: fastapi-app: build: context: . dockerfile: Dockerfile ports: - "8000:8000" volumes: - .:/app env_file: - .env environment: - PYTHONPATH=/app - DATABASE_URL=${DATABASE_URL} - FFMPEG_BIN=/usr/bin/ffmpeg - FFPROBE_BIN=/usr/bin/ffprobe restart: unless-stopped depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s networks: - fastapi-network postgres: image: postgres:15 env_file: - .env environment: POSTGRES_DB: ${POSTGRES_DB} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} ports: - "${POSTGRES_PORT}:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 5 networks: - fastapi-network redis: image: redis:7-alpine ports: - "6379:6379" volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 networks: - fastapi-network networks: fastapi-network: driver: bridge volumes: postgres_data: redis_data: