services: postgres: image: postgres:16-alpine environment: POSTGRES_USER: ${POSTGRES_USER:?POSTGRES_USER 未设置} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD 未设置} POSTGRES_DB: ${POSTGRES_DB:-football} ports: - "${POSTGRES_PORT:-5433}:5432" volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:?POSTGRES_USER 未设置}"] interval: 5s timeout: 5s retries: 5 api: build: . command: uvicorn src.api.app:app --host 0.0.0.0 --port 8000 --reload ports: - "${API_PORT:-8000}:8000" env_file: .env depends_on: postgres: condition: service_healthy volumes: - ./src:/app/src - ./alembic:/app/alembic - ./alembic.ini:/app/alembic.ini frontend: image: nginx:alpine ports: - "${FRONTEND_PORT:-3000}:80" volumes: - ./frontend/dist:/usr/share/nginx/html - ./frontend/nginx.conf:/etc/nginx/conf.d/default.conf:ro depends_on: - api volumes: pgdata: