Nicholas Chin has uploaded this change for review.

View Change

docker/doc.coreboot.org: Install pip modules into virtual env

Currently, pip modules are installed system-wide, which may cause
conflicts with modules installed using the package manager. Newer
versions of Python will also result in an error by default if pip tries
to install modules to an "externally managed environment" [1], which
would prevent the container from sucessfully building with newer
versions of Python.

[1] https://peps.python.org/pep-0668/

Change-Id: Idd9cc5e6fb28b42ef8e4fa5db01eb9ef192ba0ec
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
---
M util/docker/doc.coreboot.org/Dockerfile
M util/docker/doc.coreboot.org/makeSphinx.sh
2 files changed, 7 insertions(+), 2 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/11/80311/1
diff --git a/util/docker/doc.coreboot.org/Dockerfile b/util/docker/doc.coreboot.org/Dockerfile
index df741d8..1039d36 100644
--- a/util/docker/doc.coreboot.org/Dockerfile
+++ b/util/docker/doc.coreboot.org/Dockerfile
@@ -3,6 +3,10 @@
COPY makeSphinx.sh /makeSphinx.sh

RUN apk add --no-cache python3 py3-pip make bash git openjdk8-jre ttf-dejavu fontconfig \
+ && chmod 755 /makeSphinx.sh
+ENV VIRTUAL_ENV="/python3"
+ENV PATH=$VIRTUAL_ENV/bin:$PATH
+RUN python3 -m venv ${VIRTUAL_ENV} \
&& pip3 install --upgrade --no-cache-dir pip \
&& pip3 install --no-cache-dir \
jinja2==3.1.2 \
@@ -10,8 +14,7 @@
sphinx===6.2.1 \
sphinxcontrib-ditaa===1.0.2 \
sphinx_autobuild===2021.3.14 \
- sphinx_rtd_theme===1.2.2 \
- && chmod 755 /makeSphinx.sh
+ sphinx_rtd_theme===1.2.2

ADD https://github.com/stathissideris/ditaa/releases/download/v0.11.0/ditaa-0.11.0-standalone.jar \
/usr/lib/ditaa-0.11.0-standalone.jar
diff --git a/util/docker/doc.coreboot.org/makeSphinx.sh b/util/docker/doc.coreboot.org/makeSphinx.sh
index 96a593c..918eb16 100755
--- a/util/docker/doc.coreboot.org/makeSphinx.sh
+++ b/util/docker/doc.coreboot.org/makeSphinx.sh
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

+source $VIRTUAL_ENV/bin/activate
+
if [ "$1" == "livehtml" ]; then
echo "Starting live documentation build"
cd /data-in/Documentation && make livesphinx BUILDDIR=/tmp/build

To view, visit change 80311. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Idd9cc5e6fb28b42ef8e4fa5db01eb9ef192ba0ec
Gerrit-Change-Number: 80311
Gerrit-PatchSet: 1
Gerrit-Owner: Nicholas Chin <nic.c3.14@gmail.com>
Gerrit-MessageType: newchange