更新 'Jenkinsfile'

main
newrain001 9 months ago
parent 9e89ff0602
commit 52d6c46f77
  1. 7
      Jenkinsfile

7
Jenkinsfile vendored

@ -2,7 +2,8 @@ pipeline {
agent any
environment {
docker_image = "my-web-app:latest"
DOCKER_HOST = "tcp://192.168.75.149:2375"
DOCKER_IMAGE = "my-web-app:latest"
K8S_DEPLOYMENT_NAME = "my-web-app-deployment"
}
@ -11,7 +12,7 @@ pipeline {
steps {
script {
try {
docker.build("${docker_image}")
docker.build("${DOCKER_IMAGE}")
} catch (Exception e) {
// 处理构建错误
echo "构建镜像失败: ${e.message}"
@ -26,7 +27,7 @@ pipeline {
script {
try {
docker.withRegistry('http://core.harbor.cn', 'registry-credentials') {
docker.image("${docker_image}").push()
docker.image("${DOCKER_IMAGE}").push()
}
} catch (Exception e) {
// 处理推送错误

Loading…
Cancel
Save