Browse Source

Перевод на новый базовый образ

Tomishinets Vladimir 3 years ago
parent
commit
46b487717a
2 changed files with 10 additions and 7 deletions
  1. 1 2
      Dockerfile
  2. 9 5
      Jenkinsfile

+ 1 - 2
Dockerfile

@@ -1,5 +1,4 @@
-FROM registry.sdsys.ru/iru/iru-base:7.6
-#FROM jcr.infoclinica.ru/iru/iru-base:7.6
+FROM images.sdsys.ru/sys/iru-base:7.6
 ENTRYPOINT ["docker-entrypoint.sh"]
 COPY docker-entrypoint.sh healthcheck.sh /usr/share/web-registry-portal/bin/
 COPY application-logger.xml /etc/web-registry-portal/

+ 9 - 5
Jenkinsfile

@@ -16,6 +16,7 @@ pipeline {
     DOCKER_CERT_PATH='/run/secrets/swarm'
     DHOST='tcp://dev-iru-swarm.infoclinica.lan:2376 DOCKER_TLS_VERIFY=1'
     DOCKER_REGISTRY='dev-registry.infoclinica.ru:5000'
+    BASE_REGISTRY='images.sdsys.ru'
     NEWTAG=''
   }
   parameters {
@@ -38,12 +39,15 @@ pipeline {
   stages {
     stage("Build") {
       steps {
-        echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
-        sh "docker build --build-arg repo=${repo} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ."
         script {
-           NEWTAG = sh script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} rpm -q --qf %{VERSION}-%{RELEASE} ${PACKAGE_NAME} 2> /dev/null", returnStdout: true
-           NEWTAG = repo + "-" + NEWTAG + "_" + BUILD_NUMBER
-           echo "NEWTAG is $NEWTAG"
+          withCredentials([usernamePassword(credentialsId: 'registry', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
+            echo "Building ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER}."
+            sh "docker login -u ${USERNAME} -p ${PASSWORD} ${BASE_REGISTRY}"
+            sh "docker build --build-arg repo=${repo} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ."
+          }
+          NEWTAG = sh script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} rpm -q --qf %{VERSION}-%{RELEASE} ${PACKAGE_NAME} 2> /dev/null", returnStdout: true
+          NEWTAG = repo + "-" + NEWTAG + "_" + BUILD_NUMBER
+          echo "NEWTAG is $NEWTAG"
         }
         sh "docker tag ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${repo}-${BUILD_NUMBER} ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${NEWTAG}"
       }