commit a72859d81359888f081944e91f133f2b97cfffab
parent 2eb7ca38bd4d2906e92871ba267fe7400943316b
Author: Matthias Jaros <jaros@mailbox.org>
Date: Wed, 29 Oct 2025 20:44:07 +0100
Updated build file to use arguments
Diffstat:
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
@@ -13,7 +13,11 @@ pipeline {
GIT_BRANCH = 'trunk'
GIT_CREDENTIALS = '' // Jenkins credentialsId (leave empty for public)
REGISTRY = 'docker.it-jaros.com' // e.g. ghcr.io/you or registry.example.com/namespace
+ DOCKER_HUB = 'jarlucmat/git-server'
+ GROUP_ID = 'com.it-jaros.git'
+ IMAGE_NAME = "${REGISTRY}/${GROUP_ID}"
PLATFORMS = 'linux/arm64/v8,linux/amd64'
+ ALPINE_VERSION = '3.20'
}
stages {
@@ -36,13 +40,7 @@ pipeline {
steps {
script {
env.GIT_SHA = sh(script: "git rev-parse --short HEAD", returnStdout: true).trim()
- env.VERSION = sh(script: "cat src/version", returnStdout: true).trim()
-
- // compose image name + tags
- env.GROUP_ID = "com.it-jaros.git"
- env.IMAGE_NAME = "${REGISTRY}/${GROUP_ID}"
- echo "sha=${env.GIT_SHA}"
- echo "image=${env.IMAGE_NAME}"
+ env.APP_VERSION = sh(script: "cat src/version", returnStdout: true).trim()
}
}
}
@@ -61,12 +59,15 @@ pipeline {
echo "$DOCKER_PASS" | docker login $REGISTRY -u "$DOCKER_USER" --password-stdin
DOCKER_BUILDKIT=1 docker buildx build \
- --pull \
--platform ${PLATFORMS} \
+ --build-arg APP_VERSION=${APP_VERSION} \
+ --build-arg ALPINE_VERSION=${ALPINE_VERSION} \
-t ${IMAGE_NAME}:${GIT_SHA} \
- -t ${IMAGE_NAME}:${VERSION} \
+ -t ${IMAGE_NAME}:${APP_VERSION} \
+ -t ${IMAGE_NAME}:${APP_VERSION}-alpine${ALPINE_VERSION} \
-t ${IMAGE_NAME}:latest \
- --push \
+ --push \
+ .
.
'''
}
@@ -88,10 +89,13 @@ pipeline {
DOCKER_BUILDKIT=1 docker buildx build \
--platform ${PLATFORMS} \
- -t jarlucmat/git-server:${GIT_SHA} \
- -t jarlucmat/git-server:${VERSION} \
- -t jarlucmat/git-server:latest \
- --push \
+ --build-arg APP_VERSION=${APP_VERSION} \
+ --build-arg ALPINE_VERSION=${ALPINE_VERSION} \
+ -t ${DOCKER_HUB}:${GIT_SHA} \
+ -t ${DOCKER_HUB}:${APP_VERSION} \
+ -t ${DOCKER_HUB}:${APP_VERSION}-alpine${ALPINE_VERSION} \
+ -t ${DOCKER_HUB}:latest \
+ --push \
.
'''
}