This commit is contained in:
gxl 2026-06-03 09:24:10 +08:00
parent a184e74b07
commit 3ff16fe6fd
1 changed files with 9 additions and 14 deletions

View File

@ -35,22 +35,17 @@ steps:
- name: 远程 Docker Compose 部署
image: docker.m.daocloud.io/library/docker:cli
environment:
# 1. 从 Secret 动态读取你的阿里云 ACR 凭证
- ALIYUN_REGISTRY: registry.cn-zhangjiakou.aliyuncs.com
- ALIYUN_USER:
ALIYUN_REGISTRY: registry.cn-zhangjiakou.aliyuncs.com
ALIYUN_USER:
from_secret: aliyun_acr_username
- ALIYUN_PASS:
ALIYUN_PASS:
from_secret: aliyun_acr_password
- DOCKER_HOST: tcp://136_ssh_host:2375
commands:
# 👉 核心操作 1命令远程服务器登录阿里云彻底解决之前 pull access denied 报错
- echo "$ALIYUN_PASS" | docker login --username "$ALIYUN_USER" --password-stdin $ALIYUN_REGISTRY
# 👉 核心操作 2利用项目根目录下的 docker-compose.yaml让远程服务器拉取最新镜像
- docker compose pull
# 👉 核心操作 3一键启动/更新Compose 会自动帮你停止旧容器、删掉旧容器、并用新镜像拉起新容器
- docker compose up -d
DOCKER_HOST: tcp://136_ssh_host:2375
commands:
# 👉 顺手帮你把不安全的 echo 管道改成了安全的官方原生参数
- docker login --username "$ALIYUN_USER" --password "$ALIYUN_PASS" $ALIYUN_REGISTRY
- docker compose pull
- docker compose up -d
when:
event: push
branch: master