diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..810c2c2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM jruby:9.1-jdk + +RUN apt-get update -qq && apt-get install -y build-essential +RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc + +ENV GEM_HOME /usr/local/bundle +ENV PATH $GEM_HOME/bin:$PATH +RUN gem install bundler -v '< 2' \ + && bundle config --global path "$GEM_HOME" \ + && bundle config --global bin "$GEM_HOME/bin" + +# don't create ".bundle" in all our apps +ENV BUNDLE_APP_CONFIG $GEM_HOME + +WORKDIR /app + +# these didn't work as ONBUILD, strangely. Idk why. -JBM +COPY Gemfile ./ +COPY Gemfile.lock ./ +COPY Jarfile ./ +COPY Jarfile.lock ./ +RUN bundle install --system +RUN jruby -S jbundle install +COPY . . + +EXPOSE 9292 +CMD ["jruby", "-G", "-r", "jbundler", "-S", "rackup", "-o", "0.0.0.0", "config.ru"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..74dbf32 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +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 + + 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' + } + } +}