diff --git a/Dockerfile b/Dockerfile index 810c2c2..84e5e91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ COPY Gemfile ./ COPY Gemfile.lock ./ COPY Jarfile ./ COPY Jarfile.lock ./ -RUN bundle install --system -RUN jruby -S jbundle install +RUN bundle install --system && \ + jruby -S jbundle install COPY . . EXPOSE 9292 diff --git a/Jenkinsfile b/Jenkinsfile index 74dbf32..e8301e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,26 +1,35 @@ -node("docker-node") { - docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { - - git branch: "master", url: "ssh://git@git.ervine.org/jonny/x86_64-jruby-tabula", credentialsId: 'jenkins-to-git' - - sh "git rev-parse HEAD > .git/commit-id" - def commit_id = readFile('.git/commit-id').trim() - println commit_id +podTemplate(yaml: """ +kind: Pod +spec: + containers: + - name: kaniko + image: gcr.io/kaniko-project/executor:debug-539ddefcae3fd6b411a95982a830d987f4214251 + imagePullPolicy: Always + command: + - /busybox/cat + tty: true + volumeMounts: + - name: jenkins-docker-cfg + mountPath: /kaniko/.docker + volumes: + - name: jenkins-docker-cfg + projected: + sources: + - secret: + name: regcred + items: + - key: .dockerconfigjson + path: config.json +""" + ) { - try { - stage "build" - def app = docker.build "library/x86_64/jruby/tabula" - - stage "publish" - app.push("${env.BUILD_NUMBER}") - app.push("latest") - - stage('Deploy on K8s'){ - sh "/usr/local/bin/kubectl -n utils delete po tabula" - } - } - catch (err) { - currentBuild.result = 'FAILURE' - } + node(POD_LABEL) { + stage('Build with Kaniko') { + git url: 'ssh://git.ervine.org/jonny/x86_64-jruby-tabula.git', credentialsId: 'jenkins-to-git' + container('kaniko') { + sh '/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=harbor.ervine.dev/library/x86_64/jruby/tabula:9.1' + } } + } } +