Commit 57a44cfb authored by Administrator's avatar Administrator

更新build.yml

parent 1b222252
...@@ -2,6 +2,11 @@ variables: ...@@ -2,6 +2,11 @@ variables:
replicas: 2 replicas: 2
port: 80 port: 80
only:
variables: [$appenv=="prod"]
variables:
springprofile: --spring.profiles.active=prod
# 定义 stages # 定义 stages
stages: stages:
- build - build
...@@ -14,7 +19,7 @@ build: ...@@ -14,7 +19,7 @@ build:
- mvn -Dmaven.test.skip=true clean package -U - mvn -Dmaven.test.skip=true clean package -U
- echo "appname is ${appname}, port is ${port}, replicas is ${replicas}, nodeName is ${nodeName}, hostNetwork is ${hostNetwork}" - echo "appname is ${appname}, port is ${port}, replicas is ${replicas}, nodeName is ${nodeName}, hostNetwork is ${hostNetwork}"
- if [ -d ${appname}-server ]; then cp ${appname}-server/target/*SNAPSHOT.jar app.jar; else cp target/*SNAPSHOT.jar app.jar; fi - if [ -d ${appname}-server ]; then cp ${appname}-server/target/*SNAPSHOT.jar app.jar; else cp target/*SNAPSHOT.jar app.jar; fi
- docker build -t 192.168.123.7:5000/${appname}:latest --no-cache . - docker build -t 192.168.123.7:5000/${appname}:latest --build-args appenv=${springprofile} --no-cache .
- docker push 192.168.123.7:5000/${appname}:latest - docker push 192.168.123.7:5000/${appname}:latest
- python3 /home/ubuntu/k8s-template/deployment.py --appname=${appname} --port=${port} --hostNetwork=${hostNetwork} --nodeName=${nodeName} --image=192.168.123.7:5000/${appname}:latest --replicas=${replicas} > deployment.yaml - python3 /home/ubuntu/k8s-template/deployment.py --appname=${appname} --port=${port} --hostNetwork=${hostNetwork} --nodeName=${nodeName} --image=192.168.123.7:5000/${appname}:latest --replicas=${replicas} > deployment.yaml
- kubectl apply -f deployment.yaml - kubectl apply -f deployment.yaml
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