This commit is contained in:
parent
e446d1c692
commit
8a610320c4
|
|
@ -1,9 +1,14 @@
|
||||||
# 第 90 次部署
|
# 第 95 次部署
|
||||||
# 💡 全局变量块
|
|
||||||
variables:
|
variables:
|
||||||
- &APP_REGISTRY "push.lovestory.cyou"
|
# --- 仓库与私服配置 ---
|
||||||
- &APP_PULL_REGISTRY "registry.lovestory.cyou"
|
- &APP_REGISTRY "push.lovestory.cyou" # 推送镜像的私服域名
|
||||||
- &PROJECT_NAME "abhors/demo"
|
- &APP_PULL_REGISTRY "registry.lovestory.cyou" # 拉取基础镜像的私服域名
|
||||||
|
- &PROJECT_NAME "abhors/demo" # 项目镜像路径与名称
|
||||||
|
- &PROJECT_PORT "8080"
|
||||||
|
- &FULL_PUSH_REPO "push.lovestory.cyou/abhors/demo" # 拼接后的完整推送地址
|
||||||
|
- &FULL_PULL_REPO "push.lovestory.cyou/abhors/demo:latest" # 远程部署拉取的目标地址
|
||||||
|
|
||||||
|
# --- 部署目标机配置 ---
|
||||||
- &CONTAINER_NAME "demo-container"
|
- &CONTAINER_NAME "demo-container"
|
||||||
- &DEPLOY_HOST "43.143.243.136"
|
- &DEPLOY_HOST "43.143.243.136"
|
||||||
- &DEPLOY_PORT "22"
|
- &DEPLOY_PORT "22"
|
||||||
|
|
@ -23,14 +28,13 @@ steps:
|
||||||
branch: master
|
branch: master
|
||||||
|
|
||||||
- name: 官方标准构建与推送 (宿主机物理硬缓存版)
|
- name: 官方标准构建与推送 (宿主机物理硬缓存版)
|
||||||
image: woodpeckerci/plugin-docker-buildx:latest-insecure
|
image: docker.m.daocloud.io/woodpeckerci/plugin-docker-buildx:latest-insecure
|
||||||
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
privileged: true
|
|
||||||
settings:
|
settings:
|
||||||
insecure: true
|
repo: *FULL_PUSH_REPO
|
||||||
repo: push.lovestory.cyou/abhors/demo
|
registry: *APP_REGISTRY
|
||||||
registry: push.lovestory.cyou
|
|
||||||
username:
|
username:
|
||||||
from_secret: nexus_docker_username
|
from_secret: nexus_docker_username
|
||||||
password:
|
password:
|
||||||
|
|
@ -50,16 +54,24 @@ steps:
|
||||||
password:
|
password:
|
||||||
from_secret: *DEPLOY_PASS_SECRET
|
from_secret: *DEPLOY_PASS_SECRET
|
||||||
secrets: [ nexus_docker_username, nexus_docker_password ]
|
secrets: [ nexus_docker_username, nexus_docker_password ]
|
||||||
envs: [ nexus_docker_username, nexus_docker_password ]
|
envs:
|
||||||
|
- nexus_docker_username
|
||||||
|
- nexus_docker_password
|
||||||
|
- DEPLOY_HOST=*DEPLOY_HOST
|
||||||
|
- CONTAINER_NAME=*CONTAINER_NAME
|
||||||
|
- FULL_PULL_REPO=*FULL_PULL_REPO
|
||||||
|
- APP_REGISTRY=*APP_REGISTRY
|
||||||
|
- PROJECT_PORT=*PROJECT_PORT
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- echo "========================================="
|
- echo "========================================="
|
||||||
- echo "🚀 开始部署节点:*DEPLOY_HOST"
|
- echo "🚀 开始部署节点:$DEPLOY_HOST"
|
||||||
- echo "========================================="
|
- echo "========================================="
|
||||||
- docker login --username "$nexus_docker_username" --password "$nexus_docker_password" "push.lovestory.cyou"
|
- docker login --username "$nexus_docker_username" --password "$nexus_docker_password" "$APP_REGISTRY"
|
||||||
- docker stop "demo-container" || true
|
- docker stop "$CONTAINER_NAME" || true
|
||||||
- docker rm "demo-container" || true
|
- docker rm "$CONTAINER_NAME" || true
|
||||||
- docker pull "push.lovestory.cyou/abhors/demo:latest"
|
- docker pull "$FULL_PULL_REPO"
|
||||||
- docker run -d --name "demo-container" -p 8080:8080 --restart always "push.lovestory.cyou/abhors/demo:latest"
|
- docker run -d --name "$CONTAINER_NAME" -p "$PROJECT_PORT":"$PROJECT_PORT" --restart always "$FULL_PULL_REPO"
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
branch: master
|
branch: master
|
||||||
Loading…
Reference in New Issue