From 3e5e494bd892b2ae9a4cd9676137e15946531bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Sat, 9 Mar 2019 17:51:25 +0100 Subject: [PATCH] Install python requirements in venv in docker image Installing the requirements in a virtualenv is necessary to run "pip install ..." commands in development mode, when the USERID is != 0. --- CHANGELOG.md | 1 + docs/dev.rst | 4 ++-- tutor/templates/build/openedx/Dockerfile | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caba70e..837d073 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Latest +- [Improvement] Install python requirements in virtual env in docker image - [Bugfix] Add missing volume for theme development - [Improvement] Rename "config [non]interactive" command to "config save [--silent]" - [Improvement] More explicit logging during environment generation diff --git a/docs/dev.rst b/docs/dev.rst index 55cdcc4..e316441 100644 --- a/docs/dev.rst +++ b/docs/dev.rst @@ -43,7 +43,7 @@ In order to run a fork of edx-platform, dependencies need to be properly install export TUTOR_EDX_PLATFORM_PATH=/path/to/edx-platform tutor dev run lms npm install - tutor dev run lms pip install --src ../venv/src --requirement requirements/edx/development.txt + tutor dev run lms pip install --requirement requirements/edx/development.txt tutor dev run lms python setup.py install tutor dev run lms openedx-assets build @@ -73,7 +73,7 @@ Watch the themes folders for changes (in a different terminal):: tutor dev watchthemes -Make changes to some of the files inside your theme directory: the theme assets should be automatically recompiled and visible at http://localhost:8000. +Make changes to some of the files inside the theme directory: the theme assets should be automatically recompiled and visible at http://localhost:8000. Assets management ----------------- diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index 1b57ca2..ece85fd 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -6,7 +6,7 @@ MAINTAINER RĂ©gis Behmo # Install system requirements RUN apt update && \ # Global requirements - apt install -y language-pack-en git python-virtualenv build-essential software-properties-common curl git-core libxml2-dev libxslt1-dev python-pip libmysqlclient-dev python-apt python-dev libxmlsec1-dev libfreetype6-dev swig gcc g++ \ + apt install -y language-pack-en git python-virtualenv build-essential software-properties-common curl git-core libxml2-dev libxslt1-dev python-virtualenv libmysqlclient-dev python-apt python-dev libxmlsec1-dev libfreetype6-dev swig gcc g++ \ # openedx requirements gettext gfortran graphviz graphviz-dev libffi-dev libfreetype6-dev libgeos-dev libjpeg8-dev liblapack-dev libpng12-dev libsqlite3-dev libxml2-dev libxmlsec1-dev libxslt1-dev lynx nodejs npm ntp pkg-config \ # Our requirements @@ -36,12 +36,15 @@ RUN cd /tmp \ # Install python requirements (clone source repos in a separate dir, otherwise # they will be overwritten when we mount edx-platform) ENV NO_PYTHON_UNINSTALL 1 -RUN pip install --src ../venv/src -r requirements/edx/base.txt -RUN pip install --src ../venv/src -r requirements/edx/development.txt +RUN virtualenv /openedx/venv +ENV PATH /openedx/venv/bin:${PATH} +ENV VIRTUAL_ENV /openedx/venv/ +RUN pip install setuptools==39.0.1 pip==9.0.3 +RUN pip install -r requirements/edx/development.txt # Install patched version of ora2 RUN pip uninstall -y ora2 && \ - pip install --src ../venv/src git+https://github.com/regisb/edx-ora2.git@open-release/hawthorn.2#egg=ora2==2.1.17 + pip install git+https://github.com/regisb/edx-ora2.git@open-release/hawthorn.2#egg=ora2==2.1.17 # Install a recent version of nodejs RUN nodeenv /openedx/nodeenv --node=8.9.3 --prebuilt