From 5f8e4ae7fa2af9e54fcc8c06b2afd04dec803e14 Mon Sep 17 00:00:00 2001 From: Jonathan Ervine Date: Wed, 22 Apr 2020 11:33:21 +0800 Subject: [PATCH] new file: Dockerfile new file: Jenkinsfile Initial commit --- Dockerfile | 29 +++++++++++++++++++++++++++++ Jenkinsfile | 23 +++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ddd8e9a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Base on latest (edge) alpine image +FROM opensuse/leap:15.1 + +MAINTAINER “Jonathan Ervine” + +# Install updates +ENV LANG='en_US.UTF-8' \ + LANGUAGE='en_US.UTF-8' \ + TERM='xterm' \ + STEP_USER='step' \ + STEP_GROUP='step' \ + STEP_UID='1001' \ + STEP_GID='1001' \ + STEP_VERSION='0.14.2' + +RUN zypper -n in tar wget gzip +RUN groupadd -g $STEP_GID $STEP_GROUP +RUN useradd -u $STEP_UID -g $STEP_GROUP -M $STEP_USER + +RUN wget https://github.com/smallstep/cli/releases/download/v$STEP_VERSION/step_linux_$STEP_VERSION_amd64.tar.gz \ + mkdir -p /step/bin \ + tar -xxvf step_linux_$STEP_VERSION_amd64.tar.gz -C /step/bin/ \ + rm step_linux_$STEP_VERSION_amd64.tar.gz + +EXPOSE 9000/tcp + +USER $STEP_USER + +CMD [ "/bin/sh" ] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..b6ed28c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,23 @@ +node("docker-node") { + docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') { + + git branch: "master", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-suse-stepCA", 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/suse/stepCA" + + stage "publish" + app.push("${env.BUILD_NUMBER}") + app.push("latest") + app.push("0.14.2") + } + catch (err) { + currentBuild.result = 'FAILURE' + } + } +}