fix: API 改为 8088 且不映射宿主机端口,避免与 sshd 的 9527 冲突;脚本增加 9527 检查

Made-with: Cursor
This commit is contained in:
whm
2026-03-17 22:30:19 +08:00
parent 20a035a745
commit 6044786380
3 changed files with 121 additions and 19 deletions

View File

@@ -1,16 +1,19 @@
# 域名与 HTTPS 由 Nginx Proxy Manager 统一配置: https://npm.yuxindazhineng.com/nginx/proxy
# 本 compose 只暴露 9527(api)、9528(web)、9529(admin),由 NPM 反向代理到对外域名
version: "3.8"
# 对外仅暴露 443HTTPS内部 api/web/admin 不映射宿主机端口
# version 已废弃,已移除
services:
api:
build:
context: .
dockerfile: server/Dockerfile
args:
GOPROXY: ${GOPROXY:-https://goproxy.cn,direct}
REGISTRY_MIRROR: ${REGISTRY_MIRROR:-}
image: yh_web-api:latest
container_name: yh_api
environment:
- PORT=9527
# PORT=8088 仅容器内监听,不映射到宿主机(无 ports 配置)
- PORT=8088
- MONGODB_URI=${MONGODB_URI:-mongodb://mongo:27017}
- MONGODB_DB=${MONGODB_DB:-yxd-agent-testing}
- GIN_MODE=release
@@ -19,33 +22,50 @@ services:
- mongo
networks:
- yh_net
ports:
- "9527:9527"
# 不暴露宿主机端口,仅由 nginx 容器反代
web:
build:
context: ./web
dockerfile: Dockerfile
args:
REGISTRY_MIRROR: ${REGISTRY_MIRROR:-}
image: yh_web-web:latest
container_name: yh_web
networks:
- yh_net
ports:
- "9528:80"
# 不暴露宿主机端口,仅由 nginx 容器反代
admin:
build:
context: ./admin
dockerfile: Dockerfile
args:
REGISTRY_MIRROR: ${REGISTRY_MIRROR:-}
image: yh_web-admin:latest
container_name: yh_admin
networks:
- yh_net
# 不暴露宿主机端口,仅由 nginx 容器反代
nginx:
image: ${REGISTRY_MIRROR:-docker.m.daocloud.io/library/}nginx:alpine
container_name: yh_nginx
ports:
- "9529:80"
- "443:443"
volumes:
- ./nginx/yuheng.docker.conf:/etc/nginx/conf.d/default.conf:ro
- /etc/ssl/yh_web/yuheng.yuxindazhineng.com:/etc/ssl/yh_web/yuheng.yuxindazhineng.com:ro
depends_on:
- api
- web
- admin
networks:
- yh_net
mongo:
image: mongo:7
# 国内默认走镜像;海外可 export REGISTRY_MIRROR= 后直连
image: ${REGISTRY_MIRROR:-docker.m.daocloud.io/library/}mongo:7
container_name: yh_mongo
volumes:
- mongo_data:/data/db