#!groovy def repository = "registry.c.test-chamber-13.lan" def repositoryCreds = "harbor-repository-creds" def workspace def dockerFile def label = "kubernetes-${UUID.randomUUID().toString()}" def templateName = "pipeline-worker" pipeline { agent { kubernetes { yaml functions.podYaml( repo: repository, templateName: templateName, kaniko: true ) } } stages { stage ('Initalize Jenkins') { steps { script { workspace = pwd() dockerFile = """FROM ${repository}/dockerhub/library/debian:latest as builder ARG DARKICE_VERSION="1.5" RUN apt-get update \\ && apt-get --no-install-recommends --yes install ca-certificates curl build-essential tar pkg-config alsa-utils lame libmp3lame-dev libpulse-dev libjack-jackd2-dev libaudio-dev libasound2-dev libshout3-dev libmp3lame-dev \\ && mkdir /tmp/build \\ && curl -L https://github.com/rafael2k/darkice/releases/download/v\${DARKICE_VERSION}/darkice-\${DARKICE_VERSION}.tar.gz | tar -z -x -f - -C /tmp/build \\ && cd /tmp/build/darkice-\${DARKICE_VERSION}/ \\ && ./configure CXXFLAGS="-std=c++11" --with-pulseaudio --with-lame --with-alsa --with-jack \\ && make FROM ${repository}/dockerhub/library/debian:latest LABEL org.opencontainers.image.authors="The_Spider " LABEL org.opencontainers.image.title="darkice" COPY --from builder /tmp/build/darkice-\${DARKICE_VERSION}/src/darkice /usr/bin/local/ ENTRYPOINT [ "/bin/bash", "-c", "/usr/local/bin/darkice" ] """ } } } stage ('Build & Push') { steps { container ('kaniko') { script { declarativeFunctions.buildContainerMultipleDestinations( dockerFile: dockerFile, repositoryAccess: [ [ repository: repository, credentials: repositoryCreds ], ], destination: [ "${repository}/library/darkice:latest", ] ) } } } } } }