Files
cnphpbb 9b823ba34e docs(mixapi): 补充 buildx 多架构构建并调整镜像仓库
- Dockerfile/compose 头部与 readme 补充 buildx 多架构(amd64+arm64)构建示例
- IMAGE_TAG 默认改指私有仓库 hub.6t7.net/cnphpbb/mixapi 并同步各处 tag
2026-09-03 21:54:10 +08:00

61 lines
3.4 KiB
YAML
Raw Permalink 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.
# build:: docker build --build-arg MIXAPI_VER=v2.5.1cl -t hub.6t7.net/cnphpbb/mixapi:v2.5.1cl ./mixapi
# buildx:: docker buildx build --platform linux/amd64,linux/arm64 \
# --build-arg MIXAPI_VER=v2.5.1cl \
# -t hub.6t7.net/cnphpbb/mixapi:v2.5.1cl --push ./mixapi
# path:: mkdir -pv /data/volumes/mixapi/{data,logs}
# run:: docker compose -p mixapi-host --env-file ./mixapi/env.cfg -f ./mixapi/stack.host.yml up -d
# disc:: 单容器部署:复用 prod-dbs 项目里的 prod-postgresjoin 同一 docker 网络解析)
# disc:: 需先在 prod-postgres 上建好库与账号(SQL 模板见 mixapi/readme.md),
# disc:: 库名/账号与 newapi 分开(默认 mixapi),避免共用 new_api 库
# disc:: Redis 复用 dbSer/redis 的 Dev-Redis172.22.10.205,固定 IP,无密码)
# disc:: 项目名 mixapi-host,与 stack.yml 全栈部署互不冲突
# disc:: 启动顺序:先 up prod-dbs(确保 prod-dbs_default 网络存在),再 up mixapi-host
# disc:: 所有连接变量已内置默认值,复用 env.cfg 只需填密码即可
# disc:: 首次启动后浏览器访问 /setup 创建的第一个账号即为 root 管理员
services:
mixapi:
image: ${IMAGE_TAG}
container_name: mixapi_host_app
restart: always
command: --log-dir /app/logs
ports:
- "${PORT:-3000}:3000"
networks:
- prod-dbs_default # 加入 prod-dbs 默认网络,用 service 名 postgres 解析 prod-postgres
volumes:
- ${Volumes_Path:-/data/volumes/mixapi}/data:/data
- ${Volumes_Path:-/data/volumes/mixapi}/logs:/app/logs
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
# 默认值:DB_HOST=postgres 指向 prod-dbs 项目的 postgres service
# DB_NAME/DB_USER 默认 mixapi,需在 prod-postgres 预先创建
# 本机 PG 无 TLS 时显式关闭 SSL(取消下行注释并注释上行):
# - SQL_DSN=postgresql://${DB_USER:-mixapi}:${DB_PASSWORD}@${DB_HOST:-postgres}:${DB_PORT:-5432}/${DB_NAME:-mixapi}?sslmode=disable
- SQL_DSN=postgresql://${DB_USER:-mixapi}:${DB_PASSWORD}@${DB_HOST:-postgres}:${DB_PORT:-5432}/${DB_NAME:-mixapi}
# 默认值:REDIS_HOST=172.22.10.205 指向 Dev-RedisdbSer/redis.yml部署,DevNet 网段固定 IP,无密码)
# - REDIS_CONN_STRING=redis://:${REDIS_PASSWORD}@${REDIS_HOST:-172.22.10.205}:${REDIS_PORT:-6379}
- REDIS_CONN_STRING=redis://${REDIS_HOST:-172.22.10.205}:${REDIS_PORT:-6379}
- TZ=Asia/Shanghai
- BATCH_UPDATE_ENABLED=true
- ERROR_LOG_ENABLED=true
- SESSION_SECRET=${SESSION_SECRET:-}
# 渠道密钥加密密钥:默认取 SESSION_SECRET,存量数据加密后不可随意变更
# - CRYPTO_SECRET=${CRYPTO_SECRET:-}
# 可选:独立日志库(PG 或 ClickHouse),不设则日志与业务同库
# - LOG_SQL_DSN=postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST:-postgres}:${DB_PORT:-5432}/${DB_NAME:-mixapi}_log
# 流式无响应超时(秒),默认 120,出现空补全时调大:
# - STREAMING_TIMEOUT=300
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:3000/api/status >/dev/null || exit 1"]
interval: 30s
timeout: 10s
retries: 3
networks:
prod-dbs_default:
# 引用 prod-dbs 项目自动创建的默认网络,不归本 compose 管
external: true
name: prod-dbs_default