diff --git a/Dockerfile b/Dockerfile index d0ad19ac8976063c21e0967d454561f4ae75fa91..2d7b45906826bb9ee9eefb745ac4212941cb08da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,8 @@ USER root # as well as the specified version of MkDocs and the Material theme. RUN yum install -y rh-python36-python-pip && \ yum clean all && \ - /opt/rh/rh-python36/root/usr/bin/pip install --upgrade pip && \ - /opt/rh/rh-python36/root/usr/bin/pip install \ + /opt/rh/rh-python36/root/usr/bin/pip install --cache-dir /root --upgrade pip && \ + /opt/rh/rh-python36/root/usr/bin/pip install --cache-dir /root \ mkdocs==${MKDOCS_VERSION} \ mkdocs-material==${MATERIAL_VERSION} diff --git a/assemble b/assemble index 522bca90d26b65d57c2f07dc81061584eccf84a4..1480de4ab7aebb1beb938907bbb2c52098cb5ed9 100755 --- a/assemble +++ b/assemble @@ -6,17 +6,27 @@ set -e export LC_ALL=en_US.utf-8 export LANG=en_US.utf-8 -echo "---> Building the MkDocs static site" - # Save the current directory. cwd=$(pwd) # Move the original sources to another directory. mv /tmp/src /tmp/src-original -# Build the MkDocs static site in the standard directory. +# Go to the directory where the original sources have been moved to. cd /tmp/src-original/ -/opt/rh/rh-python36/root/usr/bin/mkdocs build --clean --site-dir /tmp/src/ + +# Install custom Python dependencies. +if [ -f ./requirements.txt ]; then + echo "---> Installing custom Python dependencies..." + export PYTHONPATH=$PYTHONPATH:/opt/app-root/lib/python3.6/site-packages + /opt/rh/rh-python36/root/bin/pip install \ + --cache-dir /opt/app-root/.cache \ + --target /opt/app-root/lib/python3.6/site-packages -r requirements.txt +fi + +# Build the MkDocs static site in the standard directory. +echo "---> Building the MkDocs static site..." +/opt/rh/rh-python36/root/bin/mkdocs build --clean --site-dir /tmp/src/ # Move the Nginx-related files back to the standard directory. if [ -f ./nginx.conf ]; then @@ -47,7 +57,7 @@ fi # Go back to the current directory. cd $cwd -echo "---> Calling the original assemble script" +echo "---> Calling the original assemble script..." # Call the original assemble script. /usr/libexec/s2i/assemble-original