rename docker to container or podman in build scripts

This commit is contained in:
Stephen Gaito 2020-07-07 19:01:43 +01:00
parent 0573a78bb6
commit 5cde162633
19 changed files with 262 additions and 253 deletions

View File

@ -19,7 +19,7 @@ jobs:
include:
- os: linux
dist: bionic
env: DOCKER_FROM="ubuntu:18.04"
env: CONTAINER_FROM="ubuntu:18.04"
services:
- docker
addons:

View File

@ -52,16 +52,18 @@ For most users, you probably really want to simply download one of the
(It will not currently work on MacOS or Alpine based machines).
- [Docker](https://www.docker.com/) Image from the [`pdf2htmlEX` Docker
- [OCI](https://opencontainers.org/) Image from the [`pdf2htmlEX` Docker
hub](https://hub.docker.com/orgs/pdf2htmlex/repositories).
This will work on any machine with Docker installed.
This will work on any machine with an OCI Container system (such as
Docker, Podman, CRI-O, Kubernetes) installed.
(Note: that *advanced* use of `pdf2htmlEX` requires careful attention to
the configuration of various tools, such as fontconfig, iconv and your
locally available fonts use by the poppler and fontforge libraries. The
docker images created by the pdf2htmlEX team might not be as well
configured for *your needs* as a docker created and configured by you)
OCI container images created by the pdf2htmlEX team might not be as well
configured for *your needs* as an OCI container created and configured
by you)
### Building yourself
@ -163,7 +165,7 @@ Typically, most users, will run one of the following "top-level" scripts:
1. AppImage
2. Docker image
2. OCI Container image
3. Debian archive
@ -172,7 +174,7 @@ Typically, most users, will run one of the following "top-level" scripts:
1. Alpine tar file
2. Docker image
2. OCI Container image
3. **`runTests`**
@ -229,12 +231,12 @@ Typically, most users, will run one of the following "top-level" scripts:
`pdf2htmlEX`, installs it and `poppler-data` into a Debian archive
(`*.deb`).
- **`createDockerAlpineImageFromTarFile`**: Installs the Alpine tar file
- **`createContainerAlpineImageFromTarFile`**: Installs the Alpine tar file
archive of `pdf2htmlEX` created by `createAlpineTarFile` into an Alpine
Docker image.
Container.
- **`createDockerUbuntuImageFromDeb`**: Installs the Debian archive of
`pdf2htmlEX` created by `createDebianPackage` into a Docker image.
- **`createContainerUbuntuImageFromDeb`**: Installs the Debian archive of
`pdf2htmlEX` created by `createDebianPackage` into a Container.
- **`getBuildToolsAlpine`**: Locally `apk` installs all development
*tools* required to build `pdf2htmlEX`.
@ -283,13 +285,13 @@ Typically, most users, will run one of the following "top-level" scripts:
`pdf2htmlEX/pdf2htmlEX/test` directory. See the
`pdf2htmlEX/pdf2htmlEx/test` directory's Readme file for details.
- **`uploadDockerImage`**: Upload the `pdf2htmlEX` Docker image to
- **`uploadContainerImage`**: Upload the `pdf2htmlEX` Container image to
Docker hub repository associated to the docker hub users specified in
the `DOCKER_USERNAME` environement variable.
the `DOCKER_HUB_USERNAME` environement variable.
Unless the `DOCKER_USERNAME` and `DOCKER_PASSWORD` environment variables
are pre-defined, this script will prompt the user for the respective
values.
Unless the `DOCKER_HUB_USERNAME` and `DOCKER_HUB_PASSWORD` environment
variables are pre-defined, this script will prompt the user for the
respective values.
- **`uploadGitHubRelease`**: Upload the `pdf2htmlEX` artefacts (AppImage,
Debian archive, test results, etc) to the *continuous* section of the

View File

@ -1,7 +1,7 @@
#!/bin/sh
# This shell script builds the complete pdf2htmlEX application LOCALLY
# (It does not create the AppImage or Docker images)
# (It does not create the AppImage or Container images)
# Adjust the following two environment variables to suit your needs
#

View File

@ -1,7 +1,7 @@
#!/bin/sh
# This shell script builds the complete pdf2htmlEX application LOCALLY
# (It does not create the AppImage or Docker images)
# (It does not create the AppImage or Container images)
# Adjust the following two environment variables to suit your needs
#

View File

@ -1,12 +1,13 @@
#!/bin/sh
# This shell script creates a docker image from an existing pdf2htmlEX
# This shell script creates a tar file which can use used to create an OCI
# container from an existing pdf2htmlEX.
#
# This is the part which can run *inside* a docker container.
# This is the part which can run *inside* an OCI container.
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX Docker Image (run inside a docker container)"
echo "CREATING pdf2htmlEX Container Image (run inside an OCI container)"
echo " (based on Alpine linux $BUILD_DIST)"
echo "-------------------------------------------------------------------"
echo ""

View File

@ -57,11 +57,11 @@ wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/$LI
chmod a+x $LINUX_DEPLOY_APP_IMAGE
if [ -f /.dockerenv ] ; then
# WE ARE INSIDE A DOCKER CONTAINER...
if [ ! -w /dev/fuse ] ; then
# We are in an environment in which FUSE is not useable...
#
# We explicilty extract the appimage to a squashfs to allow it to be used
# inside Docker containers
# even if FUSE is not available.
#
./$LINUX_DEPLOY_APP_IMAGE --appimage-extract
#

View File

@ -0,0 +1,77 @@
#!/bin/sh
# This shell script creates a container image from an existing pdf2htmlEX
#
# This is the part which must be run *outside* of any OCI container.
echo ""
echo "-------------------------------------------------------------------"
echo "CREATING pdf2htmlEX Container Image (run outside any OCI container)"
echo " (based on Alpine linux $BUILD_DIST)"
echo "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
# source buildScripts/reSourceVersionEnvs
. buildScripts/reSourceVersionEnvs
set -ev
mkdir -p imageBuild/containerDir
cd imageBuild/containerDir
cp ../$ALPINE_NAME.* .
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 ./$ALPINE_NAME.* /root/
WORKDIR /root
RUN chmod a+x $ALPINE_NAME.install && \
./$ALPINE_NAME.install
# 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

View File

@ -0,0 +1,78 @@
#!/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

View File

@ -1,73 +0,0 @@
#!/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
set -ev
mkdir -p imageBuild/dockerDir
cd imageBuild/dockerDir
cp ../$ALPINE_NAME.* .
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 ./$ALPINE_NAME.* /root/
WORKDIR /root
RUN chmod a+x $ALPINE_NAME.install && \
./$ALPINE_NAME.install
# 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 $DOCKER_NAME dockerDir

View File

@ -1,74 +0,0 @@
#!/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 (from deb archive)"
echo "-------------------------------------------------------------------"
echo ""
# Collect everything that will be needed...
# source buildScripts/reSourceVersionEnvs
. buildScripts/reSourceVersionEnvs
set -ev
cd imageBuild
mkdir -p dockerDir
cp $DPKG_NAME dockerDir
cd 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 ./$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 $DOCKER_NAME dockerDir

View File

@ -2,7 +2,7 @@
set -ev
# This shell script creates the pdf2htmlEX AppImage and Docker Images
# This shell script creates the pdf2htmlEX AppImage and Container Images
#################
# do the creation
@ -11,9 +11,6 @@ set -ev
./buildScripts/createAlpineTarFile
if [ -x "$(which docker)" ]; then
./buildScripts/createDockerAlpineImageFromTarFile
if [ -x "$(which docker)" -o -x "$(which podman)" ]; then
./buildScripts/createContainerAlpineImageFromTarFile
fi

View File

@ -2,7 +2,7 @@
set -ev
# This shell script creates the pdf2htmlEX AppImage and Docker Images
# This shell script creates the pdf2htmlEX AppImage and Container Images
#################
# do the creation
@ -13,9 +13,6 @@ set -ev
./buildScripts/createDebianPackage
if [ -x "$(which docker)" ]; then
./buildScripts/createDockerUbuntuImageFromDeb
if [ -x "$(which docker)" -o -x "$(which podman)" ]; then
./buildScripts/createContainerUbuntuImageFromDeb
fi

View File

@ -29,8 +29,8 @@ echo " machine arch: [$MACHINE_ARCH]"
echo "release env:"
echo " build date: [$BUILD_DATE]"
echo " build time: [$BUILD_TIME]"
echo " docker from: [$DOCKER_FROM]"
echo " docker name: [$DOCKER_NAME]"
echo " container from: [$CONTAINER_FROM]"
echo " container name: [$CONTAINER_NAME]"
echo " appImage name: [$APPIMAGE_NAME]"
echo " dpkg name: [$DPKG_NAME]"
echo "uploadTool suffix: [$UPLOADTOOL_SUFFIX]"

View File

@ -34,6 +34,6 @@ export DEBIAN_FRONTEND=noninteractive
./buildScripts/runTests
./buildScripts/createAppImage
./buildScripts/createDebianPackage
./buildScripts/createDockerUbuntuImageFromDeb
./buildScripts/createContainerUbuntuImageFromDeb
#./buildScripts/uploadGitHubRelease
#./buildScripts/uploadDockerImage
#./buildScripts/uploadContainerImage

View File

@ -0,0 +1,53 @@
#!/bin/sh
# This shell script uploads the pdf2htmlEX container image to docker hub
#
# We EXPECT the following environment variables to be set:
# DOCKER_HUB_USERNAME
#
# You can OPTIONALLY set the following environment variables:
# DOCKER_HUB_PASSWORD (if not set you will be asked for your password)
#
# source ./buildScripts/reSourceVersionEnvs
. ./buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "UPLOADING pdf2htmlEX Container Image to Docker Hub"
echo "-------------------------------------------------------------------"
echo ""
##################################
# push container image
#
if [ -x "$(which docker)" -o -x "$(which podman)" ]; then
if [ ! -x "$(which docker)"]; then
alias docker=podman
fi
if [ -z "$DOCKER_HUB_USERNAME" ]; then
echo ""
read -p "Enter the Docker hub usernane): " DOCKER_HUB_USERNAME
echo ""
if [ -z "$DOCKER_HUB_USERNAME" ]; then
echo "DOCKER_HUB_USERNAME not set... so we do not know where to push image."
exit 1
fi
fi
if [ -z "$DOCKER_HUB_PASSWORD" ]; then
echo ""
echo "Please type your the Docker hub password"
docker login -u "$DOCKER_HUB_USERNAME"
else
echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin
fi
docker push $DOCKER_USERNAME/pdf2htmlex
else
echo "Neither Docker nor Podman are installed... skipping upload of container image."
fi

View File

@ -1,49 +0,0 @@
#!/bin/sh
# This shell script uploads the pdf2htmlEX docker image to docker hub
#
# We EXPECT the following environment variables to be set:
# DOCKER_USERNAME
#
# You can OPTIONALLY set the following environment variables:
# DOCKER_PASSWORD (if not set you will be asked for your password)
#
# source ./buildScripts/reSourceVersionEnvs
. ./buildScripts/reSourceVersionEnvs
echo ""
echo "-------------------------------------------------------------------"
echo "UPLOADING pdf2htmlEX Docker Image to Docker Hub"
echo "-------------------------------------------------------------------"
echo ""
##################################
# push docker image
#
if [ -x "$(which docker)" ]; then
if [ -z "$DOCKER_USERNAME" ]; then
echo ""
read -p "Enter the Docker usernane): " DOCKER_USERNAME
echo ""
if [ -z "$DOCKER_USERNAME" ]; then
echo "DOCKER_USERNAME not set... so we do not know where to push image."
exit 1
fi
fi
if [ -z "$DOCKER_PASSWORD" ]; then
echo ""
echo "Please type your the Docker hub password"
docker login -u "$DOCKER_USERNAME"
else
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
docker push $DOCKER_USERNAME/pdf2htmlex
else
echo "Docker is not installed... skipping upload of docker image."
fi

View File

@ -4,10 +4,10 @@
#
# We EXPECT the following environment variables to be set:
# GITHUB_TOKEN
# DOCKER_USERNAME
# DOCKER_HUB_USERNAME
#
# You can OPTIONALLY set the following environment variables:
# DOCKER_PASSWORD (if not set you will be asked for your password)
# DOCKER_HUB_PASSWORD (if not set you will be asked for your password)
#
# source ./buildScripts/reSourceVersionEnvs
@ -18,7 +18,7 @@ cp ./buildScripts/reSourceVersionEnvs imageBuild/buildInfo.sh
echo ""
echo "-------------------------------------------------------------------"
echo "UPLOADING pdf2htmlEX AppImage and Docker Images"
echo "UPLOADING pdf2htmlEX AppImage and Container Images"
echo "-------------------------------------------------------------------"
echo ""
@ -72,7 +72,7 @@ echo " login $GITHUB_USERNAME" >> $HOME/.netrc
echo " password $GITHUB_TOKEN" >> $HOME/.netrc
echo $APPIMAGE_NAME > appImageName.txt
echo $DOCKER_NAME > dockerImageName.txt
echo $CONTAINER_NAME > containerImageName.txt
echo $DPKG_NAME > debianArchiveName.txt
echo $TEST_RESULTS_NAME > testResultsName.txt
@ -81,12 +81,12 @@ deleteReleaseByTag "$TRAVIS_REPO_SLUG" "continuous-$BUILD_DIST"
createNewRelease "$TRAVIS_REPO_SLUG" "continuous-$BUILD_DIST" "Latest $BUILD_DIST release" \
../buildScripts/uploadGitHubReleaseMessage
uploadAnAsset $upload_url "appImageName.txt" "text/plain"
uploadAnAsset $upload_url "testResultsName.txt" "text/plain"
uploadAnAsset $upload_url "buildInfo.sh" "text/plain"
uploadAnAsset $upload_url "dockerImageName.txt" "text/plain"
uploadAnAsset $upload_url "debianArchiveName.txt" "text/plain"
uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip"
uploadAnAsset $upload_url $TEST_RESULTS_NAME "application/zip"
uploadAnAsset $upload_url $DPKG_NAME "application/x-debian-package"
uploadAnAsset $upload_url "appImageName.txt" "text/plain"
uploadAnAsset $upload_url "testResultsName.txt" "text/plain"
uploadAnAsset $upload_url "buildInfo.sh" "text/plain"
uploadAnAsset $upload_url "containerImageName.txt" "text/plain"
uploadAnAsset $upload_url "debianArchiveName.txt" "text/plain"
uploadAnAsset $upload_url $APPIMAGE_NAME "application/zip"
uploadAnAsset $upload_url $TEST_RESULTS_NAME "application/zip"
uploadAnAsset $upload_url $DPKG_NAME "application/x-debian-package"

View File

@ -18,7 +18,7 @@ We release three types of binary objects:
While the Debian archive is built on a specific Ubuntu release, it can
usually be used on any more recent Ubuntu releases.
3. You can alternatively get pdf2htmlEX Docker images from Docker Hub in
3. You can alternatively get pdf2htmlEX Container images from Docker Hub in
either of the repositories:
pdf2htmlEX/pdf2htmlEX (offical release)

View File

@ -1,6 +1,6 @@
#!/bin/sh
# This shell script uploads already existing pdf2htmlEX AppImage and Docker
# This shell script uploads already existing pdf2htmlEX AppImage and Container
# Images
################
@ -8,10 +8,10 @@
set -ev
./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; }
./buildScripts/reportEnvs || { echo 'reportEnvs FAILED' ; exit 1 ; }
./buildScripts/uploadGitHubRelease || { echo 'uploadGitHubRelease FAILED' ; exit 1 ; }
./buildScripts/uploadGitHubRelease || { echo 'uploadGitHubRelease FAILED' ; exit 1 ; }
./buildScripts/uploadDockerImage || { echo 'uploadDockerImage FAILED' ; exit 1 ; }
./buildScripts/uploadContainerImage || { echo 'uploadContainerImage FAILED' ; exit 1 ; }