2026-02-11 22:40:35 +08:00
|
|
|
|
# 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:
|
2026-02-13 00:29:12 +08:00
|
|
|
|
- "${HOST_PORT:-10001}:${CONTAINER_PORT:-8000}" # 宿主机端口:容器端口
|
2026-02-11 22:40:35 +08:00
|
|
|
|
volumes:
|
|
|
|
|
|
- ./uploads:/app/uploads
|
|
|
|
|
|
- ./html_output:/app/html_output
|
|
|
|
|
|
- ./logs:/app/logs
|
|
|
|
|
|
- ./.env:/app/.env:ro
|
|
|
|
|
|
environment:
|
2026-02-13 00:29:12 +08:00
|
|
|
|
# 应用端口配置(从settings.py读取)
|
|
|
|
|
|
- HOST=${HOST:-0.0.0.0}
|
|
|
|
|
|
- PORT=${CONTAINER_PORT:-8000}
|
2026-02-11 22:40:35 +08:00
|
|
|
|
# 数据库配置
|
|
|
|
|
|
- DB_HOST=postgres
|
|
|
|
|
|
- DB_PORT=5432
|
|
|
|
|
|
- DB_NAME=${DB_NAME:-moldinsight}
|
|
|
|
|
|
- DB_USER=${DB_USER:-moldinsight_user}
|
|
|
|
|
|
- DB_PASSWORD=${DB_PASSWORD:-moldinsight_password}
|
2026-03-15 13:33:47 +08:00
|
|
|
|
# RustFS配置
|
|
|
|
|
|
- RUSTFS_ENDPOINT=http://minio:9000
|
|
|
|
|
|
- RUSTFS_ACCESS_KEY=${MINIO_ACCESS_KEY:-minioadmin}
|
|
|
|
|
|
- RUSTFS_SECRET_KEY=${MINIO_SECRET_KEY:-minioadmin}
|
2026-02-11 22:40:35 +08:00
|
|
|
|
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
|