Commit 264e730d authored by 金凯强's avatar 金凯强 🎨

Update .gitlab-ci.yml

parent ad914ec9
Pipeline #20789 failed
......@@ -6,7 +6,7 @@ stages:
- deploy
variables:
APP_NAME: dxserver_web
APP_NAME: install_web
APP_IMAGE: "${HUANSI_REGISTRY_URL}/huansi/${APP_NAME}"
before_script:
......@@ -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
only:
- web
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment