version: '3.8' services: db: image: postgres:15 environment: POSTGRES_USER: engine_user POSTGRES_PASSWORD: engine_password POSTGRES_DB: portfolio_db ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U engine_user -d portfolio_db"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7 ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 engine: build: . depends_on: db: condition: service_healthy redis: condition: service_healthy environment: DATABASE_URL: postgresql://engine_user:engine_password@db:5432/portfolio_db REDIS_URL: redis://redis:6379/0 volumes: - .:/app ports: - "8080:8080" command: uvicorn api:app --host 0.0.0.0 --port 8080 stop_signal: SIGINT healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 30s timeout: 10s retries: 3