# docker-compose.yml - 完整版(包含PostgreSQL和MinIO) services: postgres: image: postgres:15 container_name: moldinsight_postgres environment: POSTGRES_DB: ${DB_NAME:-moldinsight} POSTGRES_USER: ${DB_USER:-moldinsight_user} POSTGRES_PASSWORD: ${DB_PASSWORD:-moldinsight_password} ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-moldinsight_user} -d ${DB_NAME:-moldinsight}"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped networks: - moldinsight_network minio: image: minio/minio:latest container_name: moldinsight_minio command: server /data --console-address ":9001" environment: MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin} MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minioadmin} ports: - "9000:9000" # API端口 - "9001:9001" # 控制台端口 volumes: - minio_data:/data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 20s retries: 3 restart: unless-stopped networks: - moldinsight_network moldinsight: build: . container_name: moldinsight_app ports: - "10001:8000" # 宿主机端口:容器端口 volumes: - ./uploads:/app/uploads - ./html_output:/app/html_output - ./logs:/app/logs - ./.env:/app/.env:ro environment: # 应用内部使用8000端口(容器内) - PORT=8000 # 数据库配置 - DB_HOST=postgres - DB_PORT=5432 - DB_NAME=${DB_NAME:-moldinsight} - DB_USER=${DB_USER:-moldinsight_user} - DB_PASSWORD=${DB_PASSWORD:-moldinsight_password} # MinIO配置 - MINIO_ENDPOINT=minio:9000 - MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY:-minioadmin} - MINIO_SECRET_KEY=${MINIO_SECRET_KEY:-minioadmin} - MINIO_SECURE=false depends_on: postgres: condition: service_healthy minio: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] interval: 30s timeout: 10s retries: 3 start_period: 60s networks: - moldinsight_network volumes: postgres_data: driver: local minio_data: driver: local networks: moldinsight_network: driver: bridge