improve deployment process
This commit is contained in:
29
Jenkinsfile
vendored
29
Jenkinsfile
vendored
@@ -15,18 +15,7 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build image') {
|
||||
steps {
|
||||
sh """
|
||||
docker build \
|
||||
--file kirby/Dockerfile \
|
||||
--tag ${IMAGE_REF} \
|
||||
kirby
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Push image') {
|
||||
stage('Build & Push image') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'gitea-container-registry',
|
||||
@@ -34,9 +23,23 @@ pipeline {
|
||||
passwordVariable: 'REGISTRY_PASSWORD'
|
||||
)]) {
|
||||
sh """
|
||||
if ! docker buildx inspect jenkins-builder >/dev/null 2>&1; then
|
||||
docker buildx create --name jenkins-builder --use
|
||||
else
|
||||
docker buildx use jenkins-builder
|
||||
fi
|
||||
docker buildx inspect --bootstrap
|
||||
|
||||
echo "${REGISTRY_PASSWORD}" | docker login ${REGISTRY_HOST} \
|
||||
--username "${REGISTRY_USER}" --password-stdin
|
||||
docker push ${IMAGE_REF}
|
||||
|
||||
docker buildx build \
|
||||
--platform linux/amd64 \
|
||||
--file Dockerfile \
|
||||
--tag ${IMAGE_REF} \
|
||||
--push \
|
||||
.
|
||||
|
||||
docker logout ${REGISTRY_HOST}
|
||||
"""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user