-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
45 lines (43 loc) · 1.78 KB
/
Copy pathdocker-compose.yml
File metadata and controls
45 lines (43 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 单服务部署:前端 nginx 容器,反代到外部 BE
# 用法:
# docker compose up -d --build # 默认 BE 走 host.docker.internal:18090
# BACKEND_UPSTREAM_HOST=10.0.0.5:18090 docker compose up -d # 覆盖 BE 地址
# docker compose logs -f frontend # 看日志
# docker compose down # 停
# compose 项目名 = 在 Docker UI 里显示的 stack 名;与后端 batch-platform 统一前缀。
# 不设则默认取目录名 batch-console。可被 -p / COMPOSE_PROJECT_NAME 覆盖。
name: batch-platform-console
services:
frontend:
build:
context: .
dockerfile: Dockerfile
args:
# 想严格 typecheck 改 build(慢 ~20s);快速发布走 build:fast
BUILD_MODE: ${BUILD_MODE:-build:fast}
image: batch-console:latest
container_name: batch-console
restart: unless-stopped
ports:
- '${HOST_PORT:-8080}:80'
environment:
# nginx upstream;开发本机:host.docker.internal:18090(macOS/Windows 可直接用,Linux 需要加 extra_hosts)
# 18090 = 后端 .env.local CONSOLE_API_PORT 的宿主机映射端口(容器内 18080 → 宿主 18090);
# 此默认必须与后端 console-api 实际发布端口一致,否则前端 nginx 反代 502。
BACKEND_UPSTREAM_HOST: ${BACKEND_UPSTREAM_HOST:-host.docker.internal:18090}
NGINX_PORT: 80
extra_hosts:
# Linux 需要这行才能让容器解析 host.docker.internal(macOS/Windows 自带)
- 'host.docker.internal:host-gateway'
healthcheck:
test: ['CMD', 'curl', '-fs', 'http://localhost/healthz']
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
# 日志旋转:防容器写满磁盘
logging:
driver: json-file
options:
max-size: '10m'
max-file: '3'