Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
install.web
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
Script
install.web
Commits
0479101a
Commit
0479101a
authored
Mar 16, 2020
by
黄贤军
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://47.110.145.204:2222/script/install.web
parents
e7f624ce
78b2eb2c
Pipeline
#20817
passed with stage
in 1 minute and 3 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
23 deletions
+8
-23
.gitlab-ci.yml
.gitlab-ci.yml
+8
-23
No files found.
.gitlab-ci.yml
View file @
0479101a
...
...
@@ -3,15 +3,15 @@ image: docker:latest
stages
:
-
build
-
push
-
deploy
variables
:
APP_NAME
:
dxserver
_web
APP_NAME
:
install
_web
APP_IMAGE
:
"
${HUANSI_REGISTRY_URL}/huansi/${APP_NAME}"
before_script
:
-
docker login -u $HUANSI_USER -p $HUANSI_PASSWORD $HUANSI_REGISTRY_URL
build
:
stage
:
build
retry
:
2
...
...
@@ -19,6 +19,8 @@ build:
-
dev
script
:
-
docker build -t ${APP_IMAGE}:${CI_COMMIT_REF_NAME} .
except
:
-
master
push
:
stage
:
push
...
...
@@ -26,25 +28,8 @@ push:
tags
:
-
dev
script
:
-
docker push ${APP_IMAGE}:${CI_COMMIT_REF_NAME}
-
docker build -t ${APP_IMAGE}:${APP_VERSION} .
-
docker push ${APP_IMAGE}:${APP_VERSION}
-
echo "success"
except
:
-
dev
deploy-master
:
stage
:
deploy
retry
:
2
tags
:
-
dev
variables
:
APP_CNAME
:
"
${APP_NAME}-${CI_COMMIT_REF_NAME}"
# 默认不需要操作
APP_PORT
:
8110
# 开放端口号,这个需要申请端口号开放 以下都是环境变量
API
:
"
http://172.17.0.1:8109/"
# 环境变量 API地址
PORT
:
8000
#环境变量 PORT
script
:
-
docker ps -a | grep -i ${APP_CNAME} > /dev/null 2>&1 && docker stop ${APP_CNAME} && docker rm ${APP_CNAME}
-
docker images|grep none|grep ${APP_IMAGE} > /dev/null 2>&1 && docker images|grep none|grep ${APP_IMAGE}|awk '{print $3}'|xargs docker rmi
# 参考环境变量的传递,-e "API1=${API2}",将API2变量传给至程序的API1接收
-
docker run --name ${APP_CNAME} -d -p ${APP_PORT}:8000 -e "API=${API}" -e "PORT=${PORT}" $APP_IMAGE:${CI_COMMIT_REF_NAME}
only
:
-
master
\ No newline at end of file
-
web
\ No newline at end of file
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