jenkins流水线

1.拉取代码

https://gitee.com/Wjc_project/yygh-parent.git

jenkins流水线_第1张图片

2、项目编译

mvn clean package -Dmaven.test.skip=true
ls hospital-manage/target

jenkins流水线_第2张图片

3、构建镜像

ls hospital-manage/target
docker build -t hospital-manage:latest -f hospital-manage/Dockerfile ./hospital-manage/

ls server-gateway/target
docker build -t server-gateway:latest -f server-gateway/Dockerfile ./server-gateway/

ls service/service-cmn/target
docker build -t service-cmn:latest -f service/service-cmn/Dockerfile ./service/service-cmn/

ls service/service-hosp/target
docker build -t service-hosp:latest -f service/service-hosp/Dockerfile ./service/service-hosp/

ls service/service-order/target
docker build -t service-order:latest -f service/service-order/Dockerfile ./service/service-order/

ls service/service-oss/target
docker build -t service-oss:latest -f service/service-oss/Dockerfile ./service/service-oss/

ls service/service-sms/target
docker build -t service-sms:latest -f service/service-sms/Dockerfile ./service/service-sms/

ls service/service-statistics/target
docker build -t service-statistics:latest -f service/service-statistics/Dockerfile ./service/service-statistics/

ls service/service-task/target
docker build -t service-task:latest -f service/service-task/Dockerfile ./service/service-task/

ls service/service-user/target
docker build -t service-user:latest -f service/service-user/Dockerfile ./service/service-user/

jenkins流水线_第3张图片

4、镜像推送


echo "$DOCKER_PWD_VAR" | docker login $REGISTRY -u "$DOCKER_USER_VAR" --password-stdin

docker tag hospital-manage:latest $REGISTRY/$DOCKERHUB_NAMESPACE/hospital-manage:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/hospital-manage:SNAPSHOT-$BUILD_NUMBER

docker tag server-gateway:latest $REGISTRY/$DOCKERHUB_NAMESPACE/server-gateway:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/server-gateway:SNAPSHOT-$BUILD_NUMBER

docker tag service-cmn:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-cmn:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-cmn:SNAPSHOT-$BUILD_NUMBER

docker tag service-hosp:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-hosp:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-hosp:SNAPSHOT-$BUILD_NUMBER

docker tag service-order:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-order:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-order:SNAPSHOT-$BUILD_NUMBER

docker tag service-oss:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-oss:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-oss:SNAPSHOT-$BUILD_NUMBER

docker tag service-sms:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-sms:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-sms:SNAPSHOT-$BUILD_NUMBER

docker tag service-statistics:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-statistics:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-statistics:SNAPSHOT-$BUILD_NUMBER

docker tag service-task:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-task:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-task:SNAPSHOT-$BUILD_NUMBER

docker tag service-user:latest $REGISTRY/$DOCKERHUB_NAMESPACE/service-user:SNAPSHOT-$BUILD_NUMBER

docker push $REGISTRY/$DOCKERHUB_NAMESPACE/service-user:SNAPSHOT-$BUILD_NUMBER

jenkins流水线_第4张图片

jenkins流水线_第5张图片

5、部署dev环境

"$KUBECONFIG_CREDENTIAL_ID"

hospital-manage/deploy/**
server-gateway/deploy/**
service/service-cmn/deploy/**
service/service-hosp/deploy/**
service/service-order/deploy/**
service/service-oss/deploy/**
service/service-sms/deploy/**
service/service-statistics/deploy/**
service/service-task/deploy/**
service/service-user/deploy/**

jenkins流水线_第6张图片

6、发送确认邮件

jenkins流水线_第7张图片

你可能感兴趣的:(jenkins,java,运维)