Files
geMoldInsight/docker-compose.yml
T
2026-02-13 00:29:12 +08:00

93 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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:
- "${HOST_PORT:-10001}:${CONTAINER_PORT:-8000}" # 宿主机端口:容器端口
volumes:
- ./uploads:/app/uploads
- ./html_output:/app/html_output
- ./logs:/app/logs
- ./.env:/app/.env:ro
environment:
# 应用端口配置(从settings.py读取)
- HOST=${HOST:-0.0.0.0}
- PORT=${CONTAINER_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