fix: 容器内 = 80,宿主机 = 9090
All checks were successful
Web UI CI/CD / build-and-deploy (push) Successful in 3m33s

映射 = -p 9090:80(把外部 9090 转发到内部 80)
This commit is contained in:
lzh
2025-12-18 13:25:01 +08:00
parent e6b1d7400d
commit 3c89e81de8

View File

@@ -55,8 +55,8 @@ jobs:
IMAGE_NAME: 'aiot-web-antd'
# 容器名称
CONTAINER_NAME: aiot-web-antd
# 宿主机端口 (根据 1Panel 规划,这里假设为 8080)
HOST_PORT: 8080
# 宿主机端口
HOST_PORT: 9090
run: |
# --- 构建阶段 ---
SHORT_SHA=$(git log -1 --format='%h')
@@ -78,6 +78,14 @@ jobs:
docker stop $CONTAINER_NAME || true
docker rm $CONTAINER_NAME || true
# 检查端口占用,如果有其他容器占用,先停止它
PORT_CONTAINER=$(docker ps --filter "publish=${HOST_PORT}" --format "{{.Names}}" | head -1)
if [ ! -z "$PORT_CONTAINER" ]; then
echo "⚠️ Port ${HOST_PORT} is occupied by container: $PORT_CONTAINER"
echo "Stopping conflicting container..."
docker stop $PORT_CONTAINER || true
fi
# 启动新容器
# -d: 后台运行
# --restart always: 开机自启