Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mould-vuecli3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lhfe
mould-vuecli3
Commits
810bab2b
Commit
810bab2b
authored
Oct 11, 2020
by
lipengcheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ci: 集成docker
parent
e49c9109
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
5 deletions
+40
-5
.gitlab-ci.yml
.gitlab-ci.yml
+40
-5
No files found.
.gitlab-ci.yml
View file @
810bab2b
...
...
@@ -36,19 +36,54 @@ job-build:
tags
:
-
tag-project2
# 登录项目部署服务器,移除旧版本项目文件,最后将打包好的文件拷贝过去
# 构建docker镜像
job-build-image
stage
:
stage-build
script
:
-
echo '打包新文件阶段'
-
pwd
-
whoami
-
docker build -t mouldvuecli3 .
-
docker login -u $DockerUser -p $DockerPwd
-
docker build -t $ImageName .
-
docker push $ImageName
-
docker rmi $ImageName
-
echo '镜像上传完毕...'
# 登录部署服务器拉取镜像并启动
job-deploy
:
stage
:
stage-deploy
# only:
# - master
script
:
-
echo '登录
项目部署服务器,移除旧版本项目文件,最后将打包好的文件拷贝过去
'
-
echo '登录
部署服务器拉取镜像并启动
'
-
pwd
-
whoami
-
ssh root@119.45.165.197 "pwd"
-
ssh root@119.45.165.197 "rm -rf /www/mould-vuecli3/dist"
-
scp -r ./dist root@119.45.165.197:/www/mould-vuecli3/
-
ssh root@119.45.165.197 "docker pull ${ImageName}"
-
ssh root@119.45.165.197 "docker rm -f ${ContainerName}"
-
ssh root@119.45.165.197 "docker images"
-
ssh root@119.45.165.197 "docker ps"
-
ssh root@119.45.165.197 "docker run -itd -p 84:80 ${ImageName}"
-
sh ./notification_boot.sh "on_success" ${CI_COMMIT_REF_SLUG} ${CI_COMMIT_SHA:0:8} "PackageName_productionRelease_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHA:0:8}"
-
echo '启动成功...'
tags
:
-
tag-project2
when
:
manual
# # 登录项目部署服务器,移除旧版本项目文件,最后将打包好的文件拷贝过去
# job-deploy:
# stage: stage-deploy
# # only:
# # - master
# script:
# - echo '登录项目部署服务器,移除旧版本项目文件,最后将打包好的文件拷贝过去'
# - pwd
# - whoami
# - ssh root@119.45.165.197 "pwd"
# - ssh root@119.45.165.197 "rm -rf /www/mould-vuecli3/dist"
# - scp -r ./dist root@119.45.165.197:/www/mould-vuecli3/
# - sh ./notification_boot.sh "on_success" ${CI_COMMIT_REF_SLUG} ${CI_COMMIT_SHA:0:8} "PackageName_productionRelease_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHA:0:8}"
# tags:
# - tag-project2
# when: manual
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment