0
点赞
收藏
分享

微信扫一扫

GitLab CICD Day 20 - 部署 Image 到服务器上

小云晓云 2023-02-11 阅读 110

​1. 服务部署到目标服务器上​

variables:
user: eric
pwd: Admin@1234
harbor: http://172.16.128.215:8080
image_hellocat: 172.16.128.215:8080/hive/hellocat


stages:
- testing
- build
- deploy_qa




deploy_to_qa:
stage: deploy_qa
tags:
- shell
before_script:
- eval $(ssh-agent -s) #执行ssh
- ssh-add <(echo "$SERVER_PRIVATE_KEY") #读取密钥并加入列表
script:
- echo "start deploying"
# 在目标机器:172.16.128.153上部署服务,先登录docker harbor,再拉镜像,并部署
- ssh -o StrictHostKeyChecking=no root@172.16.128.153 "
docker login -u $user -p $pwd $harbor &&
docker run -p 80:8000 -d 172.16.128.215:8080/hive/hellocat:latest
"

  1. 执行结果:

  GitLab CICD Day 20 - 部署 Image 到服务器上_服务器

举报

相关推荐

0 条评论