Skip to content

Commit

Permalink
Install python requirements in venv in docker image
Browse files Browse the repository at this point in the history
Installing the requirements in a virtualenv is necessary to run "pip
install ..." commands in development mode, when the USERID is != 0.
  • Loading branch information
regisb committed Mar 9, 2019
1 parent b7c31d7 commit 3e5e494
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
-----------------
Expand Down
11 changes: 7 additions & 4 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MAINTAINER Régis Behmo <[email protected]>
# 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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e5e494

Please sign in to comment.