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

explicitly split createDockerImage into an inside and an outside docker container parts

This commit is contained in:
Stephen Gaito 2020-06-12 14:50:49 +01:00
parent 501b73b489
commit bf924dca2d
3 changed files with 108 additions and 93 deletions

View File

@ -1,93 +0,0 @@
#!/bin/bash
# This bash script creates a docker image from an existing pdf2htmlEX
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX Docker Image"
echo "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
source buildScripts/reSourceVersionEnvs
source buildScripts/dockerFunctions
set -ev
mkdir -p imageBuild/dockerDir
cd pdf2htmlEX/build
sudo rm -rf install_manifest.txt
make install DESTDIR=../../imageBuild/dockerDir
cd ../../poppler-data
make install \
prefix=$PDF2HTMLEX_PREFIX \
datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \
DESTDIR=../imageBuild/dockerDir
cd ../imageBuild/dockerDir
copy_deps
# Make sure directories can be traversed by nobody
#
#find . -type d -exec chmod 755 {} \;
#
# Make sure files can be read by nobody
#
#find . -type f -exec chmod 644 {} \;
# Now. IF we have docker, THEN build the docker image...
if [ -x "$(which docker)" ]; then
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_BRANCH-$BUILD_TIME"
echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> ../../buildScripts/reSourceVersionEnvs
delete_blacklisted
cat > Dockerfile <<DOCKERFILE_HERE_DOC
FROM $DOCKER_FROM
COPY ./ /
RUN ldconfig
ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"]
DOCKERFILE_HERE_DOC
cd ..
docker build -t $DOCKER_NAME dockerDir
else
echo "Docker is not installed... skipping creation of a docker image."
fi

View File

@ -0,0 +1,46 @@
#!/bin/bash
# This bash script creates a docker image from an existing pdf2htmlEX
#
# This is the part which can run *inside* a docker container.
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX Docker Image (run inside a docker container)"
echo "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
source buildScripts/reSourceVersionEnvs
source buildScripts/dockerFunctions
set -ev
mkdir -p imageBuild/dockerDir
cd pdf2htmlEX/build
sudo rm -rf install_manifest.txt
make install DESTDIR=../../imageBuild/dockerDir
cd ../../poppler-data
make install \
prefix=$PDF2HTMLEX_PREFIX \
datadir=$PDF2HTMLEX_PREFIX/share/pdf2htmlEX \
DESTDIR=../imageBuild/dockerDir
cd ../imageBuild/dockerDir
copy_deps
# Make sure directories can be traversed by nobody
#
#find . -type d -exec chmod 755 {} \;
#
# Make sure files can be read by nobody
#
#find . -type f -exec chmod 644 {} \;

View File

@ -0,0 +1,62 @@
#!/bin/bash
# This bash 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 "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
source buildScripts/reSourceVersionEnvs
source 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_BRANCH-$BUILD_TIME"
echo "export DOCKER_FROM=\"$DOCKER_FROM\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_USERNAME=\"$DOCKER_USERNAME\"" >> ../../buildScripts/reSourceVersionEnvs
echo "export DOCKER_NAME=\"$DOCKER_NAME\"" >> ../../buildScripts/reSourceVersionEnvs
delete_blacklisted
cat > Dockerfile <<DOCKERFILE_HERE_DOC
FROM $DOCKER_FROM
COPY ./ /
RUN ldconfig
ENTRYPOINT ["$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX"]
DOCKERFILE_HERE_DOC
cd ..
docker build -t $DOCKER_NAME dockerDir