Files
Pre_Seg_Server/docker-compose.yml
2026-05-08 00:32:02 +08:00

148 lines
4.5 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: seg-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-seguser}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-segpass123}
POSTGRES_DB: ${POSTGRES_DB:-segserver}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 20
redis:
image: redis:7-alpine
container_name: seg-redis
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
minio:
image: minio/minio:RELEASE.2025-04-22T22-12-26Z
container_name: seg-minio
restart: unless-stopped
command: server /data --console-address ":9001"
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minioadmin}
ports:
- "${MINIO_PORT:-9000}:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001"
volumes:
- minio-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 5s
timeout: 5s
retries: 30
backend:
image: seg-server-backend:latest
build:
context: .
dockerfile: Dockerfile.backend
container_name: seg-backend
restart: unless-stopped
env_file: .env
environment:
DB_URL: postgresql://${POSTGRES_USER:-seguser}:${POSTGRES_PASSWORD:-segpass123}@postgres:5432/${POSTGRES_DB:-segserver}
REDIS_URL: redis://redis:6379/0
MINIO_ENDPOINT: minio:9000
MINIO_PUBLIC_ENDPOINT: ${MINIO_PUBLIC_ENDPOINT:-localhost:9000}
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
MINIO_SECURE: ${MINIO_SECURE:-false}
CORS_ORIGINS: ${CORS_ORIGINS:-["http://localhost:3000","http://127.0.0.1:3000"]}
DEMO_VIDEO_PATH: /app/demo/演视LC视频序列.mp4
DEMO_DICOM_DIR: /app/demo/演视DICOM序列
SAM_MODEL_PATH: /app/models/sam2.1_hiera_tiny.pt
SAM_MODEL_CONFIG: configs/sam2.1/sam2.1_hiera_t.yaml
SAM3_EXTERNAL_ENABLED: "false"
ports:
- "${BACKEND_PORT:-8000}:8000"
volumes:
- ${SAM_MODELS_DIR:-./models}:/app/models:ro
- ./demo:/app/demo:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 10s
timeout: 5s
retries: 30
worker:
image: seg-server-backend:latest
pull_policy: never
container_name: seg-worker
restart: unless-stopped
command: celery -A celery_app:celery_app worker --loglevel=info --pool=solo --concurrency=1
env_file: .env
environment:
DB_URL: postgresql://${POSTGRES_USER:-seguser}:${POSTGRES_PASSWORD:-segpass123}@postgres:5432/${POSTGRES_DB:-segserver}
REDIS_URL: redis://redis:6379/0
MINIO_ENDPOINT: minio:9000
MINIO_PUBLIC_ENDPOINT: ${MINIO_PUBLIC_ENDPOINT:-localhost:9000}
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
MINIO_SECURE: ${MINIO_SECURE:-false}
DEMO_VIDEO_PATH: /app/demo/演视LC视频序列.mp4
DEMO_DICOM_DIR: /app/demo/演视DICOM序列
SAM_MODEL_PATH: /app/models/sam2.1_hiera_tiny.pt
SAM_MODEL_CONFIG: configs/sam2.1/sam2.1_hiera_t.yaml
SAM3_EXTERNAL_ENABLED: "false"
volumes:
- ${SAM_MODELS_DIR:-./models}:/app/models:ro
- ./demo:/app/demo:ro
depends_on:
backend:
condition: service_healthy
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
args:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-}
VITE_WS_PROGRESS_URL: ${VITE_WS_PROGRESS_URL:-}
container_name: seg-frontend
restart: unless-stopped
ports:
- "${FRONTEND_PORT:-3000}:80"
depends_on:
backend:
condition: service_healthy
frpc:
image: snowdreamtech/frpc:latest
container_name: seg-frpc
restart: unless-stopped
profiles:
- frpc
volumes:
- ./docker/frpc/frpc.toml:/etc/frp/frpc.toml:ro
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_started
minio:
condition: service_healthy
volumes:
postgres-data:
minio-data: