services: # 1. PostgreSQL 데이터베이스 postgres: image: postgres:16-alpine container_name: asset_pilot_db restart: unless-stopped environment: POSTGRES_DB: asset_pilot POSTGRES_USER: asset_user POSTGRES_PASSWORD: ${DB_PASSWORD:-assetpilot} POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --locale=C" TZ: Asia/Seoul volumes: - postgres_data:/var/lib/postgresql/data - ./init-db:/docker-entrypoint-initdb.d - /etc/localtime:/etc/localtime:ro ports: - "5432:5432" networks: - asset_pilot_network healthcheck: test: ["CMD-SHELL", "pg_isready -U asset_user -d asset_pilot"] interval: 10s timeout: 5s retries: 5 # 2. Asset Pilot 웹 애플리케이션 app: build: context: . dockerfile: Dockerfile # 📌 command를 여기(app 서비스 내부)에 넣었습니다. command: uvicorn main:app --host 0.0.0.0 --port 8000 dns: - 8.8.8.8 - 1.1.1.1 container_name: asset_pilot_app restart: unless-stopped depends_on: postgres: condition: service_healthy environment: DATABASE_URL: postgresql://asset_user:${DB_PASSWORD:-assetpilot}@postgres:5432/asset_pilot APP_HOST: 0.0.0.0 APP_PORT: 8000 DEBUG: "False" FETCH_INTERVAL: 5 TZ: Asia/Seoul ports: - "8000:8000" networks: - asset_pilot_network volumes: - .:/app - app_logs:/app/logs - /etc/localtime:/etc/localtime:ro - /etc/timezone:/etc/timezone:ro healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s volumes: postgres_data: driver: local app_logs: driver: local networks: asset_pilot_network: driver: bridge