From eb5a8dd62e3ef39244e34c5f2f774b95be2a9089 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 28 May 2020 13:02:04 +0200 Subject: [PATCH] Initial publish --- Dockerfile | 45 ++++++++++++++++++++++++++++++++++++++++ Jenkinsfile | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 14 +++++++++++++ apt-install | 8 ++++++++ 4 files changed, 126 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 README.md create mode 100755 apt-install diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e422658 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +FROM debian:stable as builder +RUN set -xe;\ + apt-get update &&\ + apt-get install -y debootstrap &&\ + debootstrap --include=apt,ca-certificates,curl --foreign --variant=minbase buster /dest &&\ + sed -i 's/setup_proc//' /dest/debootstrap/suite-script + +FROM scratch as bootstrapped +COPY --from=builder /dest / +RUN set -xe;\ + /debootstrap/debootstrap --second-stage &&\ + rm -rf /var/cache/apt/archives/* &&\ + rm -rf /var/lib/apt/lists/* + +FROM bootstrapped as toolbuilder +ARG GOSU_VERSION +ARG DUMB_INIT_VERSION +RUN set -xe;\ + apt-get update &&\ + apt-get install -y git golang &&\ + git clone https://github.com/tianon/gosu.git /build &&\ + cd /build &&\ + git checkout $GOSU_VERSION &&\ + go get || echo 0; go build +RUN set -xe;\ + apt-get install -y build-essential &&\ + cd / &&\ + curl -LO https://github.com/Yelp/dumb-init/archive/v${DUMB_INIT_VERSION}.tar.gz &&\ + tar xvzf v${DUMB_INIT_VERSION}.tar.gz &&\ + cd dumb-init-${DUMB_INIT_VERSION} &&\ + make &&\ + cp dumb-init / + +FROM bootstrapped +ARG DATE +ARG GOSU_VERSION +ARG DUMB_INIT_VERSION +COPY --from=toolbuilder /build/build /usr/local/sbin/gosu +COPY --from=toolbuilder /dumb-init /usr/local/sbin/dumb-init +COPY apt-install /bin/apt-install +CMD "bash" +LABEL version.debian=buster \ + version.gosu=$GOSU_VERSION \ + version.dumb-init=$DUMB_INIT_VERSION \ + build.date=$DATE diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..6694d51 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,59 @@ +gosu_version = "1.12" +dumb_init_version = "1.2.2" +timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC')) + +pipeline { + agent any + stages { + stage('Build image') { + steps { + withDockerRegistry([ credentialsId: "6ff44976-23cd-4cc2-902c-de8c340e65e5", url: "https://reg.zknt.org" ]) { + script { + def customImage = docker.build("reg.zknt.org/zknt/debian", "--build-arg DATE=$timeStamp --build-arg GOSU_VERSION=$gosu_version --build-arg DUMB_INIT_VERSION=$dumb_init_version --no-cache --pull .") + aquaMicroscanner imageName: 'reg.zknt.org/zknt/debian', notCompliesCmd: '', onDisallowed: 'ignore', outputFormat: 'html' + customImage.push("buster") + customImage.push("stable") + customImage.push("10") + + registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7" + withDockerRegistry([ credentialsId: registry_credentials ]) { + def official_image = 'zknt/debian:buster' + sh "docker image tag reg.zknt.org/zknt/debian:buster " + official_image + sh "docker push " + official_image + } + } + } + } + } + } + post { + always { + emailext body: 'build finished', subject: '[jenkins] docker ' + project + ': ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true + } + } + options { + buildDiscarder(BuildHistoryManager([ + [ + conditions: [ + BuildResult(matchFailure: true) + ], + matchAtMost: 4, + continueAfterMatch: false + ], + [ + conditions: [ + BuildResult(matchSuccess: true) + ], + matchAtMost: 2, + continueAfterMatch: false + ], + [ + conditions: [ + BuildResult(matchSuccess: true, matchFailure: true) + ], + actions: [DeleteBuild()] + ] + ])) + } + +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..b365ddc --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +Debian Buster +============= + +Stock Debian 10, installed via debootstrap from official debian image. + +This image also includes: + +* [gosu](https://github.com/tianon/gosu) to simplify sudo needs in dependant images. +* [dumb-init](https://github.com/Yelp/dumb-init) to simplify signal handling. +* `apt-install` a small wrapper for apt-get install, which cleans up caches after running. + +Source repository: https://git.zknt.org/dockers/debian + +Public registry: https://hub.docker.com/r/zknt/debian diff --git a/apt-install b/apt-install new file mode 100755 index 0000000..6dbef17 --- /dev/null +++ b/apt-install @@ -0,0 +1,8 @@ +#!/bin/sh +apt-get update +apt-get install -y --no-install-recommends $@ +rc=$? +apt-get clean all +rm -rf /var/lib/apt/lists/* + +exit $rc