diff --git a/Dockerfile b/Dockerfile index b1bc538..229464c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,17 +2,22 @@ FROM alpine as build ARG VERSION ENV ALPINE_SERIES edge -ENV ALPINE_MIRROR https://uk.alpinelinux.org/alpine/${ALPINE_SERIES} +ENV ALPINE_MIRROR https://ftp.halifax.rwth-aachen.de/alpine/v${ALPINE_SERIES} ENV ALPINE_ARCH x86_64 WORKDIR /root -RUN set -xo pipefail; apk add --no-cache curl &&\ +RUN set -xo pipefail; apk add --no-cache curl gnupg &&\ curl -LO ${ALPINE_MIRROR}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz &&\ - curl -LO http://nl.alpinelinux.org/alpine/${ALPINE_SERIES}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.sha512 &&\ - sha512sum -c alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.sha512 &&\ + curl -LO ${ALPINE_MIRROR}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.asc &&\ + gpg --keyserver pool.sks-keyservers.net --recv 0482D84022F52DF1C4E7CD43293ACD0907D9495A &&\ + gpg --verify alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.asc alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz &&\ mkdir /dest &&\ tar -C /dest -xvzf alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz FROM scratch +ARG VERSION +ARG DATE COPY --from=build /dest / +RUN apk add --no-cache ca-certificates curl CMD ["/bin/sh"] +LABEL version.alpine=$VERSION build.date=$DATE diff --git a/Jenkinsfile b/Jenkinsfile index dd67d6f..99547e2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,10 @@ +version = "3.12.3" project = "alpine" repo = "zknt" version = "20200428" registry = "reg.zknt.org" registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5" +timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC')) pipeline { agent any @@ -28,11 +30,38 @@ pipeline { } } } - } post { always { - emailext body: 'build finished', subject: '[jenkins] docker '+project+': ' + currentBuild.result, to: 'cg@zknt.org', from: 'sysadm@zknt.org', attachLog: true + sh """docker container prune -f""" + sh """docker image prune -f""" + sh """docker rmi -f \$(docker images -q $registry/$repo/$project:$version)""" + sh """for image in \$(grep FROM Dockerfile | cut -d ' ' -f 2 | grep -vi -e SCRATCH -e bootstrapped | uniq); do docker rmi -f \$(docker images -q \${image}); done""" + emailext body: 'build finished', subject: '[jenkins] docker '+project+'('+version+'): ' + 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: 4, + continueAfterMatch: false + ], + [ + conditions: [ + BuildResult(matchSuccess: true, matchFailure: true) + ], + actions: [DeleteBuild()] + ] + ])) + } } diff --git a/README.md b/README.md index f3f1543..d95a05d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ stock alpine Basic Alpine base image, pulling Alpines minirootfs and extracting to `scratch`. -Builds both `edge` and latest release (currently `3.11`) in branches. +Builds both `edge` and latest release (currently `3.12`) in branches. Source repository: https://git.zknt.org/dockers/alpine diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..613f41f --- /dev/null +++ b/build.yaml @@ -0,0 +1,5 @@ +version: 3.12.3 +project: alpine +additional_tags: + - latest + - 3.12