improve deployment process

This commit is contained in:
2025-10-23 11:06:52 +02:00
parent 5edd9dedb6
commit 3012e5b994
4 changed files with 66 additions and 23 deletions

29
Jenkinsfile vendored
View File

@@ -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}
"""
}