summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthias Lucas Jaros <jarlucmat@mailbox.org>2025-10-29 20:44:07 +0100
committerGravatar Matthias Lucas Jaros <jarlucmat@mailbox.org>2025-10-29 20:44:07 +0100
commitfd6d517214ca779c7f3dc6ffda1355841c10546e (patch)
treef26f7573ebc30adbe32b6b43ed5f95c9614129c9
parent379f8c89041e625709f1d0cf921e8f82034f0b63 (diff)
Updated build file to use arguments
-rw-r--r--Jenkinsfile32
1 files changed, 18 insertions, 14 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
index eab4d03..fa01ddd 100644
--- 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 \
.
'''
}