Skip to content

Commit

Permalink
Dockerfile: switch to virtualenv
Browse files Browse the repository at this point in the history
Installing any RPM-packaged Python application will pull Python 3.6
on RHEL8/Streams8 because 3.6 is the system default.
This, in turn, will break building the ods-ci container because ods-ci
has been using Python 3.7 features since ff7ac1f.

virtualenv ( https://virtualenv.pypa.io/en/latest/ ) should be used
instead of the venv module to force Python's version to 3.8 instead
of the RHEL8/Streams8 default 3.6.

Fixes: red-hat-data-services#406
Signed-off-by: François Cami <[email protected]>
  • Loading branch information
fcami committed Jun 16, 2022
1 parent 91e8d64 commit 9f3312c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG OC_CHANNEL=stable


RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm &&\
dnf install -y python38 jq git unzip chromium chromedriver redhat-lsb-core &&\
dnf install -y python38 jq git unzip chromium chromedriver redhat-lsb-core python3-virtualenv &&\
dnf clean all

## Install yq in the image
Expand Down Expand Up @@ -43,8 +43,7 @@ COPY utils/scripts/logger.py utils/scripts/logger.py
COPY utils/scripts/util.py utils/scripts/util.py
RUN chmod +x run.sh
COPY requirements.txt setup.py .
RUN python3 --version
RUN python3 -m venv venv && source venv/bin/activate && pip3 install --upgrade pip && venv/bin/pip3 install -r requirements.txt
RUN virtualenv -p /usr/bin/python3.8 venv && source venv/bin/activate && pip3 install --upgrade pip && venv/bin/pip3 install -r requirements.txt

# set the non-root user
RUN chgrp -R 1001 $HOME/ods-ci && chown -R 1001 $HOME/ods-ci && chmod -R 744 $HOME/ods-ci
Expand Down

0 comments on commit 9f3312c

Please sign in to comment.