db867dcbe5
Deploy to Staging / deploy (push) Has been cancelled
Conflict detector / main (push) Has been cancelled
Lint Backend / lint-backend (push) Has been cancelled
Playwright Tests / changes (push) Has been cancelled
Test Backend / test-backend (push) Has been cancelled
Test Docker Compose / test-docker-compose (push) Has been cancelled
Playwright Tests / test-playwright (1, 4) (push) Has been cancelled
Playwright Tests / test-playwright (2, 4) (push) Has been cancelled
Playwright Tests / test-playwright (3, 4) (push) Has been cancelled
Playwright Tests / test-playwright (4, 4) (push) Has been cancelled
Playwright Tests / merge-playwright-reports (push) Has been cancelled
Playwright Tests / alls-green-playwright (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
134 lines
3.6 KiB
YAML
134 lines
3.6 KiB
YAML
services:
|
|
|
|
# 本地服务可通过其端口访问,也可以通过以下地址访问:
|
|
# http://api.localhost.tiangolo.com: 后端
|
|
# http://dashboard.localhost.tiangolo.com: 前端
|
|
# 等等。要启用此功能,请更新 .env,设置:
|
|
# DOMAIN=localhost.tiangolo.com
|
|
proxy:
|
|
image: traefik:3.0
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
ports:
|
|
- "80:80"
|
|
- "8090:8080"
|
|
# 从 docker-compose.yml 复制命令并添加 --api.insecure=true
|
|
command:
|
|
# 在 Traefik 中启用 Docker,以便它能读取 Docker 服务的标签
|
|
- --providers.docker
|
|
# 添加约束,只使用具有此堆栈标签的服务
|
|
- --providers.docker.constraints=Label(`traefik.constraint-label`, `traefik-public`)
|
|
# 不暴露所有 Docker 服务,只暴露明确指定的服务
|
|
- --providers.docker.exposedbydefault=false
|
|
# 创建一个监听 80 端口的入口点 "http"
|
|
- --entrypoints.http.address=:80
|
|
# 创建一个监听 443 端口的入口点 "https"
|
|
- --entrypoints.https.address=:443
|
|
# 启用访问日志,记录 HTTP 请求
|
|
- --accesslog
|
|
# 启用 Traefik 日志,用于配置和错误
|
|
- --log
|
|
# 为本地开发启用调试日志
|
|
- --log.level=DEBUG
|
|
# 启用仪表板和 API
|
|
- --api
|
|
# 为本地开发以不安全模式启用仪表板和 API
|
|
- --api.insecure=true
|
|
labels:
|
|
# 为此服务启用 Traefik,使其在公共网络中可用
|
|
- traefik.enable=true
|
|
- traefik.constraint-label=traefik-public
|
|
# 虚拟的 https-redirect 中间件,实际上不进行重定向,
|
|
# 仅用于允许在本地运行
|
|
- traefik.http.middlewares.https-redirect.contenttype.autodetect=false
|
|
networks:
|
|
- traefik-public
|
|
- default
|
|
|
|
db:
|
|
restart: "no"
|
|
ports:
|
|
- "5432:5432"
|
|
|
|
adminer:
|
|
restart: "no"
|
|
ports:
|
|
- "8080:8080"
|
|
|
|
backend:
|
|
restart: "no"
|
|
ports:
|
|
- "8000:8000"
|
|
build:
|
|
context: ./backend
|
|
# command: sleep infinity # 无限循环以保持容器存活但不执行任何操作
|
|
command:
|
|
- fastapi
|
|
- run
|
|
- --reload
|
|
- "app/main.py"
|
|
develop:
|
|
watch:
|
|
- path: ./backend
|
|
action: sync
|
|
target: /app
|
|
ignore:
|
|
- ./backend/.venv
|
|
- .venv
|
|
- path: ./backend/pyproject.toml
|
|
action: rebuild
|
|
# TODO: 在本地完成覆盖率测试后移除
|
|
volumes:
|
|
- ./backend/htmlcov:/app/htmlcov
|
|
environment:
|
|
SMTP_HOST: "mailcatcher"
|
|
SMTP_PORT: "1025"
|
|
SMTP_TLS: "false"
|
|
EMAILS_FROM_EMAIL: "noreply@example.com"
|
|
|
|
mailcatcher:
|
|
image: schickling/mailcatcher
|
|
ports:
|
|
- "1080:1080"
|
|
- "1025:1025"
|
|
|
|
frontend:
|
|
restart: "no"
|
|
ports:
|
|
- "5173:80"
|
|
build:
|
|
context: ./frontend
|
|
args:
|
|
- VITE_API_URL=http://localhost:8000
|
|
- NODE_ENV=development
|
|
|
|
playwright:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile.playwright
|
|
args:
|
|
- VITE_API_URL=http://backend:8000
|
|
- NODE_ENV=production
|
|
ipc: host
|
|
depends_on:
|
|
- backend
|
|
- mailcatcher
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- VITE_API_URL=http://backend:8000
|
|
- MAILCATCHER_HOST=http://mailcatcher:1080
|
|
# 用于本地运行时的报告
|
|
- PLAYWRIGHT_HTML_HOST=0.0.0.0
|
|
- CI=${CI}
|
|
volumes:
|
|
- ./frontend/blob-report:/app/blob-report
|
|
- ./frontend/test-results:/app/test-results
|
|
ports:
|
|
- 9323:9323
|
|
|
|
networks:
|
|
traefik-public:
|
|
# 对于本地开发,不要期望有外部 Traefik 网络
|
|
external: false
|