Files
ai_site/docker-compose.yml
whm cddf95594e fix: web API 502 — use Podman-local DNS for gateway proxy
Mount nginx template with NGINX_LOCAL_RESOLVERS and require web→gateway health in deploy checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-07 01:00:29 +08:00

133 lines
3.7 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.
# aijianzhan full stack (default)
# Data under ./.runtime/
# Web: host-built dist mounted into nginx (no node image pull each time)
#
# 宿主机端口默认绑 127.0.0.1,避免与同机 yh_web8088/9080/9081 + 宿主机 80/443及公网误暴露冲突。
# 可用 .env 覆盖compose 变量替换),例如宿主机已有 Postgres 时:
# AIJZ_PG_PUBLISH=127.0.0.1:15432
# 需要局域网访问时:
# AIJZ_WEB_PUBLISH=0.0.0.0:5173
#
# China: base images default to DaoCloud mirror via DOCKER_BASE_REGISTRY
# docker compose up -d --build
# docker compose down
x-build-args: &build_args
BASE_REGISTRY: ${DOCKER_BASE_REGISTRY:-docker.m.daocloud.io/library}
services:
postgres:
image: ${DOCKER_BASE_REGISTRY:-docker.m.daocloud.io/library}/postgres:16-alpine
environment:
POSTGRES_USER: platform
POSTGRES_PASSWORD: platform
POSTGRES_DB: platform
ports:
- "${AIJZ_PG_PUBLISH:-127.0.0.1:5432}:5432"
volumes:
- ./.runtime/pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U platform -d platform"]
interval: 3s
timeout: 5s
retries: 20
platform:
build:
context: ./platform
args:
<<: *build_args
# Podman DNS显式 hostname/别名,避免 gateway lookup platform 失败
hostname: platform
depends_on:
postgres:
condition: service_healthy
ports:
- "${AIJZ_PLATFORM_PUBLISH:-127.0.0.1:8888}:8888"
volumes:
- ./.runtime/uploads:/app/data/uploads
- ./.runtime/dbsync:/app/data/dbsync
- ./platform/etc/platform.docker.yaml:/app/etc/platform.yaml:ro
environment:
TZ: Asia/Shanghai
networks:
default:
aliases:
- platform
ai:
build:
context: ./ai-service
args:
<<: *build_args
hostname: ai
ports:
- "${AIJZ_AI_PUBLISH:-127.0.0.1:8001}:8001"
env_file:
- .env
volumes:
- ./ai-service:/app
- ./ai-service/etc/llm.yaml:/app/etc/llm.yaml:ro
- ./test:/test:ro
- ./.runtime:/runtime
environment:
TZ: Asia/Shanghai
AI_CONFIG_PATH: /app/etc/llm.yaml
DEMO_FIXTURES_DIR: /test
GENERATE_LOG_DIR: /runtime/logs/generate
FIDELITY_SHOT_DIR: /runtime/fidelity_shots
WEB_BASE: http://web:80
PLATFORM_BASE: http://platform:8888
GATEWAY_BASE: http://gateway:8180
LLM_PROVIDER: ${LLM_PROVIDER:-deepseek}
DEEPSEEK_API_KEY: ${DEEPSEEK_API_KEY:-}
MINIMAX_API_KEY: ${MINIMAX_API_KEY:-}
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
PIP_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn
networks:
default:
aliases:
- ai
gateway:
build:
context: ./gateway
args:
<<: *build_args
hostname: gateway
depends_on:
- platform
- ai
ports:
- "${AIJZ_GATEWAY_PUBLISH:-127.0.0.1:8180}:8180"
volumes:
- ./gateway/etc/gateway.docker.yaml:/app/etc/gateway.yaml:ro
environment:
TZ: Asia/Shanghai
GOPROXY: https://goproxy.cn,direct
networks:
default:
aliases:
- gateway
web:
image: ${DOCKER_BASE_REGISTRY:-docker.m.daocloud.io/library}/nginx:1.27-alpine
hostname: web
restart: unless-stopped
depends_on:
- gateway
ports:
- "${AIJZ_WEB_PUBLISH:-127.0.0.1:5173}:80"
volumes:
# :Z 供 Podman/SELinux 可读;纯 Docker 也兼容
- ./web/dist:/usr/share/nginx/html:ro,Z
# 走官方 templates + envsubst注入容器 /etc/resolv.conf 里的 DNS
- ./web/nginx.conf.template:/etc/nginx/templates/default.conf.template:ro,Z
environment:
TZ: Asia/Shanghai
NGINX_ENTRYPOINT_LOCAL_RESOLVERS: "1"
networks:
default:
aliases:
- web