From 124cae5d21c0b6dde09c61248041b892759f53e2 Mon Sep 17 00:00:00 2001 From: Stephen Gaito Date: Thu, 28 May 2020 10:59:27 +0000 Subject: [PATCH] updated createAppImage and createDockerImage scripts to be able to work inside a docker container --- buildScripts/createAppImage | 19 ++++++-- buildScripts/createDockerImage | 79 ++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 41 deletions(-) diff --git a/buildScripts/createAppImage b/buildScripts/createAppImage index 360d0fd..1cb86d2 100755 --- a/buildScripts/createAppImage +++ b/buildScripts/createAppImage @@ -41,11 +41,22 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI chmod a+x $LINUX_DEPLOY_APP_IMAGE -./$LINUX_DEPLOY_APP_IMAGE \ +if [ -f /.dockerenv ] ; then + # WE ARE INSIDE A DOCKER CONTAINER... + # + # We explicilty extract the appimage to a squashfs to allow it to be used + # inside Docker containers + # + ./$LINUX_DEPLOY_APP_IMAGE --appimage-extract + # + LINUX_DEPLOY_APP_IMAGE=squashfs-root/AppRun +fi + +./$LINUX_DEPLOY_APP_IMAGE \ -e appDir/$PDF2HTMLEX_PREFIX/bin/pdf2htmlEX \ - --create-desktop-file \ - -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ - --appdir=appDir \ + --create-desktop-file \ + -i ../pdf2htmlEX/logo/pdf2htmlEX.svg \ + --appdir=appDir \ --output appimage diff --git a/buildScripts/createDockerImage b/buildScripts/createDockerImage index aca0d3a..52321b7 100755 --- a/buildScripts/createDockerImage +++ b/buildScripts/createDockerImage @@ -8,53 +8,58 @@ echo "CREATING pdf2htmlEX Docker Image" echo "-------------------------------------------------------------------" echo "" -if [ -x "$(which docker)" ]; then +# Collect everything that will be needed... - source buildScripts/reSourceVersionEnvs +source buildScripts/reSourceVersionEnvs - source buildScripts/dockerFunctions +source buildScripts/dockerFunctions + + +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 DESTDIR=../imageBuild/dockerDir + +cd ../imageBuild/dockerDir + +copy_deps + +# 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 + 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 -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 + 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 -fi -export DOCKER_NAME="$DOCKER_USERNAME/pdf2htmlex:$PDF2HTMLEX_BRANCH-$BUILD_TIME" + 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 - - 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 DESTDIR=../imageBuild/dockerDir - - cd ../imageBuild/dockerDir - - copy_deps + 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