From 2a282231ed574fdd668e5e38f48b1df54b05060c Mon Sep 17 00:00:00 2001 From: Francia Csaba Date: Fri, 14 Jun 2024 13:34:59 +0200 Subject: [PATCH] DOCKER_REGISTRY argument --- Jenkinsfile | 10 +++++----- standard.Dockerfile | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 18e94e6..6a89a02 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { GITEA_CREDS = credentials('AMARILLO-JENKINS-GITEA-USER') TWINE_REPO_URL = "https://git.gerhardt.io/api/packages/amarillo/pypi" PLUGINS_REPO_URL = "git.gerhardt.io/api/packages/amarillo/pypi/simple" - DOCKER_REGISTRY_URL = 'https://git.gerhardt.io' + DOCKER_REGISTRY = 'git.gerhardt.io' DERIVED_DOCKERFILE = 'standard.Dockerfile' OWNER = 'amarillo' BASE_IMAGE_NAME = 'amarillo-base' @@ -61,7 +61,7 @@ pipeline { steps { echo 'Pushing image to registry' script { - docker.withRegistry(DOCKER_REGISTRY_URL, 'AMARILLO-JENKINS-GITEA-USER'){ + docker.withRegistry("https://${DOCKER_REGISTRY}", 'AMARILLO-JENKINS-GITEA-USER'){ def image = docker.image("${OWNER}/${BASE_IMAGE_NAME}:${TAG}") image.push() image.push('latest') @@ -76,10 +76,10 @@ pipeline { steps { echo 'Building image' script { - docker.withRegistry(DOCKER_REGISTRY_URL, 'AMARILLO-JENKINS-GITEA-USER'){ + docker.withRegistry("https://${DOCKER_REGISTRY}", 'AMARILLO-JENKINS-GITEA-USER'){ docker.build("${OWNER}/${IMAGE_NAME}:${TAG}", //--no-cache to make sure plugins are updated - "-f ${DERIVED_DOCKERFILE} --no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .") + "-f ${DERIVED_DOCKERFILE} --no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --build-arg='DOCKER_REGISTRY=${DOCKER_REGISTRY}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .") // "--no-cache --build-arg='PACKAGE_REGISTRY_URL=${PLUGINS_REPO_URL}' --build-arg='PLUGINS=${PLUGINS}' --secret id=AMARILLO_REGISTRY_CREDENTIALS,env=GITEA_CREDS .") } @@ -93,7 +93,7 @@ pipeline { steps { echo 'Pushing image to registry' script { - docker.withRegistry(DOCKER_REGISTRY_URL, 'AMARILLO-JENKINS-GITEA-USER'){ + docker.withRegistry("https://${DOCKER_REGISTRY}", 'AMARILLO-JENKINS-GITEA-USER'){ def image = docker.image("${OWNER}/${IMAGE_NAME}:${TAG}") image.push() image.push('latest') diff --git a/standard.Dockerfile b/standard.Dockerfile index a6e9041..3066d0b 100644 --- a/standard.Dockerfile +++ b/standard.Dockerfile @@ -1,4 +1,5 @@ -FROM amarillo/amarillo-base +ARG DOCKER_REGISTRY +FROM ${DOCKER_REGISTRY}/amarillo/amarillo-base ARG PLUGINS=\ "amarillo-metrics "\