20200917
dockers/alpine/pipeline/head This commit looks good Details

This commit is contained in:
chris 2020-12-18 13:10:31 +01:00
parent 4d87c809d6
commit b2c15d3f7f
3 changed files with 33 additions and 27 deletions

View File

@ -2,15 +2,14 @@ FROM alpine as build
ARG VERSION ARG VERSION
ENV ALPINE_SERIES edge ENV ALPINE_SERIES edge
ENV ALPINE_MIRROR https://ftp.halifax.rwth-aachen.de/alpine/v${ALPINE_SERIES} ENV ALPINE_MIRROR https://ftp.halifax.rwth-aachen.de/alpine/edge
ENV ALPINE_ARCH x86_64 ENV ALPINE_ARCH x86_64
WORKDIR /root WORKDIR /root
RUN set -xo pipefail; apk add --no-cache curl gnupg &&\ RUN set -xo pipefail; apk add --no-cache curl &&\
curl -LO ${ALPINE_MIRROR}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz &&\ curl -LO ${ALPINE_MIRROR}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz &&\
curl -LO ${ALPINE_MIRROR}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.asc &&\ curl -LO ${ALPINE_MIRROR}/releases/${ALPINE_ARCH}/alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.sha512 &&\
gpg --keyserver pool.sks-keyservers.net --recv 0482D84022F52DF1C4E7CD43293ACD0907D9495A &&\ sha512sum -c alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.sha512 &&\
gpg --verify alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz.asc alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz &&\
mkdir /dest &&\ mkdir /dest &&\
tar -C /dest -xvzf alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz tar -C /dest -xvzf alpine-minirootfs-${VERSION}-${ALPINE_ARCH}.tar.gz

45
Jenkinsfile vendored
View File

@ -1,30 +1,37 @@
version = "3.12.3" version = "20200917"
project = "alpine" project = "alpine"
repo = "zknt" repo = "zknt"
version = "20200428"
registry = "reg.zknt.org" registry = "reg.zknt.org"
registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5" registry_credentials = "6ff44976-23cd-4cc2-902c-de8c340e65e5"
timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC')) timeStamp = Calendar.getInstance().getTime().format('YYYY-MM-dd',TimeZone.getTimeZone('UTC'))
pipeline { pipeline {
agent any agent any
stages { stages {
stage('Build image') { stage('Build image') {
steps { steps {
withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) { withDockerRegistry([ credentialsId: registry_credentials, url: "https://"+registry ]) {
echo 'Starting to build docker image' script {
script { def customImage = docker.build(registry+'/'+repo+'/'+project, "--pull --build-arg VERSION=$version --build-arg DATE=$timeStamp .")
def customImage = docker.build(registry+'/'+repo+'/'+project, "--build-arg VERSION=$version .") customImage.push(version)
customImage.push(version) customImage.push("edge")
customImage.push("edge") def io_registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7"
withDockerRegistry([ credentialsId: io_registry_credentials ]) {
def io_registry_image = repo + '/' + project + ':' + version
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image
sh "docker push " + io_registry_image
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + io_registry_image.split(/\:/)[0] + ":edge"
sh "docker push " + io_registry_image.split(/\:/)[0] + ":edge"
}
registry_credentials = "3deeee3d-6fce-4430-98dd-9b4db56f43f7" def quay_credentials= "18fb6f7e-c6bc-4d06-9bf9-08c2af6bfc1a"
withDockerRegistry([ credentialsId: registry_credentials ]) { withDockerRegistry([ credentialsId: quay_credentials, url: "https://quay.io" ]) {
def official_image = repo+'/'+project+':'+version def quay_image = 'quay.io/' + repo + '/' + project + ':' + version
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image
sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + official_image.split(/:/)[0]+":edge" sh "docker push " + quay_image
sh "docker push " + official_image sh "docker image tag " + registry+'/'+repo+'/'+project+':'+version + ' ' + quay_image.split(/\:/)[0] + ":edge"
sh "docker push " + official_image.split(/:/)[0]+":edge" sh "docker push " + quay_image.split(/\:/)[0] + ":edge"
}
} }
} }
} }
@ -64,4 +71,4 @@ pipeline {
] ]
])) ]))
} }
} }

View File

@ -1,5 +1,5 @@
version: 3.12.3 ---
version: 20200917
project: alpine project: alpine
additional_tags: additional_tags:
- latest - edge
- 3.12