Tomishinets Vladimir 3 rokov pred
rodič
commit
60b5edadb8
2 zmenil súbory, kde vykonal 31 pridanie a 1 odobranie
  1. 27 0
      Dockerfile.promo-seo
  2. 4 1
      Jenkinsfile-dev

+ 27 - 0
Dockerfile.promo-seo

@@ -0,0 +1,27 @@
+FROM registry.sdsys.ru/build-image:alpine-3.10-2 as build
+ARG git_repo=git@github.com:icruportal/web-registration.git
+ARG branch=release
+ARG gradle_version=5.2.1
+COPY id_rsa /root/.ssh
+RUN export GRADLE_HOME=/opt/gradle/gradle-${gradle_version} \
+    && export PATH=${GRADLE_HOME}/bin:${PATH} \
+    && gradle -v \
+    && printf "Host github.com \n\tStrictHostKeyChecking no" > /root/.ssh/config \
+    && git clone ${git_repo} \
+    && cd web-registration && git checkout ${branch} \
+    && echo $(git log -p -1 --pretty=format:"%h"|head -n1) > /tmp/version  \
+    && cd customer-api && mvn clean install \
+    && figlet -c Building Public \
+    && cd ../promo/src/public && npm install && npm start \
+    && figlet -c Building Promo \
+    && cd ../../ && gradle tasks bootWar \
+    && rm -rf /root/.ssh/id_rsa
+
+FROM registry.sdsys.ru/iru/iru-base:7.6
+ARG DB_CLUSTER=mongodb1:27017,mongodb2:27018,mongodb3:27019
+ARG SERVER_PORT=9000
+
+HEALTHCHECK --start-period=40s --interval=15s --timeout=5s --retries=2 CMD curl -f 127.0.0.1:${SERVER_PORT} || exit 1
+COPY --from=build /web-registration/promo/build/libs/promo-0.0.1-SNAPSHOT.war /opt/
+COPY --from=build /tmp/version /tmp/
+CMD ["java", "-jar", "/opt/promo-0.0.1-SNAPSHOT.war"]

+ 4 - 1
Jenkinsfile-dev

@@ -16,6 +16,7 @@ pipeline {
     SERVICE_NAME_SEO='info_promo-seo'
     DOCKER_IMAGE_SEO='iru/promo-seo'
     GIT_REPO_SEO='git@github.com:icruportal/web-registration.git'
+    DOCKER_FILE_SEO='Dockerfile.promo-seo'
     SWARM_GIT_URL='ssh://git@git.sdsys.ru:8022/iru/stack-deploy.git'
     SWARM_GIT_NAME='stack-deploy'
     JENKINS_MAIL='jenkins@sdsys.ru'
@@ -50,11 +51,13 @@ pipeline {
               REPO=GIT_REPO_SDK
               DOCKER_IMAGE=DOCKER_IMAGE_SDK
               SERVICE_NAME=SERVICE_NAME_SDK
+              DOCKER_FILE=DOCKER_FILE_SDK
               break
             case 'promo-seo':
               REPO=GIT_REPO_SEO
               DOCKER_IMAGE=DOCKER_IMAGE_SEO
               SERVICE_NAME=SERVICE_NAME_SEO
+              DOCKER_FILE=DOCKER_FILE_SEO
               break
           }
           echo REPO
@@ -73,7 +76,7 @@ pipeline {
                   chmod 600 ${WORKSPACE}/id_rsa
                """
           }
-          sh "docker build --build-arg branch=${branch} --build-arg git_repo=${REPO} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} ."
+          sh "docker build --build-arg branch=${branch} --build-arg git_repo=${REPO} --no-cache -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} -f ${DOCKER_FILE}"
           NEWTAG = sh(script: "docker run --rm ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${BUILD_NUMBER} cat /tmp/version 2> /dev/null", returnStdout: true).trim()
           NEWTAG = branch + "-" + NEWTAG + "_" + BUILD_NUMBER
           echo "NEWTAG is $NEWTAG"