Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
32 lines
912 B
Groovy
32 lines
912 B
Groovy
pipeline {
|
|
agent any
|
|
|
|
environment {
|
|
IMG = "127.0.0.1/middleware/buildflow-web"
|
|
}
|
|
stages {
|
|
stage("Build image") {
|
|
steps {
|
|
sh "docker build -t ${IMG}:latest -t ${IMG}:${BUILD_NUMBER} ."
|
|
}
|
|
}
|
|
stage("Push to Harbor") {
|
|
steps {
|
|
withCredentials([usernamePassword(credentialsId: "harbor-admin", usernameVariable: "HU", passwordVariable: "HP")]) {
|
|
sh 'echo "$HP" | docker login 127.0.0.1 -u "$HU" --password-stdin'
|
|
sh "docker push ${IMG}:latest && docker push ${IMG}:${BUILD_NUMBER}"
|
|
}
|
|
}
|
|
}
|
|
stage("Deploy") {
|
|
steps {
|
|
sh "docker compose -f /home/xiangning/deploy/buildflow/docker-compose.yml pull buildflow-web"
|
|
sh "docker compose -f /home/xiangning/deploy/buildflow/docker-compose.yml up -d --no-deps buildflow-web"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
always { sh "docker image prune -f || true" }
|
|
}
|
|
}
|