1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00
pdf2htmlEX/buildScripts/createContainerUbuntuImageFromDeb

79 lines
1.9 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# This shell script creates an OCI container from an existing pdf2htmlEX
#
# This is the part which must be run *outside* of any OCI container.
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX OCI Container Image (from deb archive)"
echo "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
# source buildScripts/reSourceVersionEnvs
. buildScripts/reSourceVersionEnvs
set -ev
cd imageBuild
mkdir -p containerDir
cp $DPKG_NAME containerDir
cd containerDir
if [ -z "$CONTAINER_FROM" ]; then
echo ""
read -p "Enter the container image for the 'from' base: " CONTAINER_FROM
echo ""
if [ -z "$CONTAINER_FROM" ]; then
echo "CONTAINER_FROM not set... so we can not build the container image"
exit 1
fi
fi
if [ -z "$DOCKER_HUB_USERNAME" ]; then
echo ""
read -p "Enter a docker hub username: " DOCKER_HUB_USERNAME
echo ""
if [ -z "$DOCKER_HUB_USERNAME" ]; then
echo "DOCKER_HUB_USERNAME not set... so we can not build the container image"
exit 1
fi
fi
if [ -x "$(which podman)" ]; then
alias docker=podman
fi
export CONTAINER_NAME="$DOCKER_HUB_USERNAME/pdf2htmlex:$PDF2HTMLEX_NAME"
echo "export CONTAINER_FROM=\"$CONTAINER_FROM\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_HUB_USERNAME=\"$DOCKER_HUB_USERNAME\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export CONTAINER_NAME=\"$CONTAINER_NAME\"" >> ../../buildScripts/reSourceVersionEnvs
cat > Dockerfile <<DOCKERFILE_HERE_DOC
FROM $CONTAINER_FROM
COPY ./$DPKG_NAME /root
RUN apt update && \
apt -y upgrade && \
apt -y --no-install-recommends install \
/root/$DPKG_NAME
# make the /pdf directory the default working directory for any run of
# pdf2htmlEX
#
WORKDIR /pdf
ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"]
DOCKERFILE_HERE_DOC
cd ..
docker build -t $CONTAINER_NAME containerDir