Files
AI-Testing/docker-compose.yml
2026-04-12 20:10:08 +08:00

56 lines
1.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 Hub 官方镜像:请在本机 Docker 中配置「阿里云镜像加速器」后再构建/拉取
# (控制台:容器镜像服务 ACR → 镜像工具 → 镜像加速器,将地址写入 Docker Engine 的 registry-mirrors
services:
db:
image: postgres:16-alpine
container_name: exam-helper-db
restart: unless-stopped
environment:
POSTGRES_DB: exam_helper
POSTGRES_USER: exam_user
POSTGRES_PASSWORD: exam_pass
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U exam_user -d exam_helper"]
interval: 5s
timeout: 5s
retries: 10
backend:
build:
context: ./backend
container_name: exam-helper-backend
restart: unless-stopped
# AI 相关变量优先从 .env.example 注入;若存在 .env 则覆盖同名项(见 Compose env_file 顺序)
env_file:
- .env.example
- path: .env
required: false
environment:
DATABASE_URL: postgresql+psycopg://exam_user:exam_pass@db:5432/exam_helper
# 本地开发 Vite + Docker 前端均需允许
CORS_ORIGINS: http://localhost:5173,http://localhost:8173
UPLOAD_DIR: /app/uploads
volumes:
- uploads_data:/app/uploads
depends_on:
db:
condition: service_healthy
ports:
- "127.0.0.1:8866:8000"
frontend:
build:
context: ./frontend
container_name: exam-helper-frontend
restart: unless-stopped
depends_on:
- backend
ports:
- "127.0.0.1:8173:80"
volumes:
postgres_data:
uploads_data: