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
版权声明:本文标题:gitlab 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/jishu/1693677773h236294.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论