admin 管理员组

文章数量: 887019

gitlab

2019独角兽企业重金招聘Python工程师标准>>>

# 最先执行语句
before_script:- APP_NAME=microservice-staff- echo APP_NAME = $APP_NAME , CI_BUILD_REF_NAME = $CI_BUILD_REF_NAME- IPORT=8082- if [ $CI_BUILD_REF_NAME == dev ]; then PORT=8082; else PORT=9082; fi;# 定义stage,build(构建)、test(测试)、deploy(部署)
stages:- build- test- deploy# build: build image
job_build:stage: buildscript:- docker build -t registry-vpc-beijing.aliyuncs/ysn/$APP_NAME:$CI_BUILD_REF_NAME .only:- dev- test- mastertags:- shared_runner_shell# test: dev/test环境
job_test:stage: testscript:- if [ `docker ps -aq -f name=$APP_NAME-$CI_BUILD_REF_NAME` ]; then # 优雅停服curl --request POST http://localhost:$PORT/shutdown;docker stop $APP_NAME-$CI_BUILD_REF_NAME; docker rm $APP_NAME-$CI_BUILD_REF_NAME; fi- docker run--name $APP_NAME-$CI_BUILD_REF_NAME-d -p $PORT:$IPORT--network s-net --network-alias $APP_NAME-$CI_BUILD_REF_NAME-w /usr/src/myapp-v ahas-javaagent:/var/lib/aliyunahas/agent:rw-e JAVA_OPTS="-Xms128m -Xmx128m -Xmn128m -Xss1024k -Dspring.profiles.active=${CI_BUILD_REF_NAME} -Dproject.name=${APP_NAME}-${CI_BUILD_REF_NAME} -javaagent:/var/lib/aliyunahas/agent/ahas-java-agent.jar"--restart=on-failureregistry-vpc-beijing.aliyuncs/ysn/$APP_NAME:$CI_BUILD_REF_NAMEonly:- dev- testtags:- shared_runner_shell# deploy:推送阿里云容器服务部署
job_deploy:stage: deployscript:- sudo docker push registry-vpc-beijing.aliyuncs/ysn/$APP_NAME:$CI_BUILD_REF_NAMEonly:- mastertags:- shared_runner_shell

转载于:

本文标签: gitlab