diff options
author | Nicholas Chin <nic.c3.14@gmail.com> | 2024-02-05 12:59:16 -0700 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2024-03-21 16:10:44 +0000 |
commit | af68bf25aa5c9305c8ba62c272fb4f6471e3fab6 (patch) | |
tree | 7f259ccbb38677c794b602ddf5de4ac74a82dac8 /util/docker | |
parent | b348154e5edef7632a0908e261f31824a138328c (diff) |
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 the Alpine base image also mark its system wide Python
installation as an externally managed environment, which will cause
pip to return an error as per recent Python recommendations [1].
TEST:
- `make -C util/docker doc.coreboot.org` builds the container
successfully
- `make -C util/docker docker-build-docs` builds the documentation
successfully
[1] https://peps.python.org/pep-0668/
Change-Id: Idd9cc5e6fb28b42ef8e4fa5db01eb9ef192ba0ec
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80311
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'util/docker')
-rw-r--r-- | util/docker/doc.coreboot.org/Dockerfile | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/util/docker/doc.coreboot.org/Dockerfile b/util/docker/doc.coreboot.org/Dockerfile index df741d81df..b45660de1c 100644 --- a/util/docker/doc.coreboot.org/Dockerfile +++ b/util/docker/doc.coreboot.org/Dockerfile @@ -3,15 +3,22 @@ FROM alpine:3.18.3 COPY makeSphinx.sh /makeSphinx.sh RUN apk add --no-cache python3 py3-pip make bash git openjdk8-jre ttf-dejavu fontconfig \ - && pip3 install --upgrade --no-cache-dir pip \ - && pip3 install --no-cache-dir \ + && chmod 755 /makeSphinx.sh +RUN adduser -D coreboot + +USER coreboot +ENV VIRTUAL_ENV="/home/coreboot/python3" +ENV PATH=$VIRTUAL_ENV/bin:$PATH:/home/coreboot/.local/bin +RUN python3 -m venv $VIRTUAL_ENV && \ + echo "source ${VIRTUAL_ENV}/bin/activate" >> /home/coreboot/.bashrc && \ + pip3 install --upgrade --no-cache-dir pip && \ + pip3 install --no-cache-dir \ jinja2==3.1.2 \ recommonmark===0.7.1\ 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 |