From 3d98442bd8e32b477df9cb7da1abb997654b5504 Mon Sep 17 00:00:00 2001 From: The_Spider Date: Thu, 14 Apr 2022 16:15:14 -0500 Subject: [PATCH] adds calibre --- build-book-converter.jenkins | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 build-book-converter.jenkins diff --git a/build-book-converter.jenkins b/build-book-converter.jenkins new file mode 100644 index 0000000..0b896c3 --- /dev/null +++ b/build-book-converter.jenkins @@ -0,0 +1,68 @@ +#!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() + def calibreVer = "5.40.0" + dockerFile = """FROM ${repository}/dockerhub/library/ubuntu:focal + +LABEL org.opencontainers.image.authors="The_Spider " +LABEL org.opencontainers.image.title="calibre" +LABEL org.opencontainers.image.description="Docker container for converting ebooks" +LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:focal" + +RUN apt-get update && \\ + apt-get upgrade -y && \\ + apt-get install -y --no-install-recommends curl xz-utils libgl1 libxcb1 && \\ + mkdir -p /opt/calibre && \\ + curl -Lks "https://nexus.c.test-chamber-13.lan/repository/calibre/${calibreVer}/calibre-${calibreVer}-x86_64.txz" -o /tmp/calibre.tar.xz && \\ + tar -J -x -f /tmp/calibre.tar.xz -C /opt/calibre && \\ + rm -f /tmp/calibre.tar.xz +""" + } + } + } + + stage ('Build & Push') { + steps { + container ('kaniko') { + script { + declarativeFunctions.buildContainerMultipleDestinations( + dockerFile: dockerFile, + repositoryAccess: [ + [ + repository: repository, + credentials: repositoryCreds + ], + ], + destination: [ + "${repository}/library/calibre:latest", + ] + ) + } + } + } + } + } +}