1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00
pdf2htmlEX/buildScripts/createDockerAlpineImageOutside

79 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# This shell script creates a docker image from an existing pdf2htmlEX
#
# This is the part which must be run *outside* of any docker container.
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX Docker Image (run outside any docker container)"
echo " (based on Alpine linux $BUILD_DIST)"
echo "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
# source buildScripts/reSourceVersionEnvs
. buildScripts/reSourceVersionEnvs
# source buildScripts/dockerFunctions
. buildScripts/dockerFunctions
set -ev
mkdir -p imageBuild/dockerDir
cd imageBuild/dockerDir
if [ -z "$DOCKER_FROM" ]; then
echo ""
read -p "Enter the docker image for the 'from' base: " DOCKER_FROM
echo ""
if [ -z "$DOCKER_FROM" ]; then
echo "DOCKER_FROM not set... so we can not build the docker image"
exit 1
fi
fi
if [ -z "$DOCKER_USERNAME" ]; then
echo ""
read -p "Enter a docker username: " DOCKER_USERNAME
echo ""
if [ -z "$DOCKER_USERNAME" ]; then
echo "DOCKER_USERNAME not set... so we can not build the docker image"
exit 1
fi
fi
export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_NAME"
echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> ../../buildScripts/reSourceVersionEnvs
cat > Dockerfile <<DOCKERFILE_HERE_DOC
FROM $DOCKER_FROM
COPY ./ /
RUN apk update && \
apk add --no-cache \
libstdc++ \
libgcc \
gnu-libiconv \
gettext \
glib \
freetype \
fontconfig \
cairo \
libpng \
libjpeg-turbo \
libxml2
ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"]
DOCKERFILE_HERE_DOC
cd ..
docker build -t $DOCKER_NAME dockerDir