adds converter script to container
This commit is contained in:
parent
3d98442bd8
commit
4da4b7d630
@ -5,6 +5,7 @@ def repositoryCreds = "harbor-repository-creds"
|
|||||||
|
|
||||||
def workspace
|
def workspace
|
||||||
def dockerFile
|
def dockerFile
|
||||||
|
def dockerScript
|
||||||
|
|
||||||
def label = "kubernetes-${UUID.randomUUID().toString()}"
|
def label = "kubernetes-${UUID.randomUUID().toString()}"
|
||||||
def templateName = "pipeline-worker"
|
def templateName = "pipeline-worker"
|
||||||
@ -32,14 +33,35 @@ LABEL org.opencontainers.image.title="calibre"
|
|||||||
LABEL org.opencontainers.image.description="Docker container for converting ebooks"
|
LABEL org.opencontainers.image.description="Docker container for converting ebooks"
|
||||||
LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:focal"
|
LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:focal"
|
||||||
|
|
||||||
|
COPY entrypoint.sh /calibre/entrypoint.sh
|
||||||
|
|
||||||
RUN apt-get update && \\
|
RUN apt-get update && \\
|
||||||
apt-get upgrade -y && \\
|
apt-get upgrade -y && \\
|
||||||
apt-get install -y --no-install-recommends curl xz-utils libgl1 libxcb1 && \\
|
apt-get install -y --no-install-recommends curl xz-utils libgl1 libxcb1 && \\
|
||||||
|
chmod +x /calibre/entrypoint.sh && \\
|
||||||
mkdir -p /opt/calibre && \\
|
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 && \\
|
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 && \\
|
tar -J -x -f /tmp/calibre.tar.xz -C /opt/calibre && \\
|
||||||
rm -f /tmp/calibre.tar.xz
|
rm -f /tmp/calibre.tar.xz
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "-c", "/calibre/entrypoint.sh"]
|
||||||
"""
|
"""
|
||||||
|
dockerScript = """#!/usr/bin/env bash
|
||||||
|
|
||||||
|
IFS=$'\\n'
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
sleep 5s
|
||||||
|
if [ -z "$(find /calibre/input -type f \\( -iname \\*.mobi -o -iname \\*.epub -o \\*.prc \\) -print -quit)" ]; then
|
||||||
|
for i in $(find /calibre/input -type f \\( -iname \\*.mobi -o -iname \\*.epub -o \\*.prc \\)); do
|
||||||
|
/opt/calibre/ebook-convert "${i}" "/calibre/output/${i%.*}.azw3"
|
||||||
|
rm -f -v "${i}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
"""
|
||||||
|
|
||||||
|
writeFile(file: workspace + "/entrypoint.sh", text: dockerScript)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user