Skip to content
Snippets Groups Projects
Commit 113956be authored by Nikos Kasioumis's avatar Nikos Kasioumis
Browse files

Support for custom Python dependencies

* If the user has provided a `requirements.txt` file in the root
  directory of the sources it will be installed with `pip`.
parent f89ed4ba
No related branches found
No related tags found
1 merge request!4Support for custom Python dependencies
Pipeline #1126104 passed
......@@ -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}
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment