2017-07-03 10:39:19 +00:00
|
|
|
FROM ubuntu:16.04
|
|
|
|
|
2017-07-24 09:32:50 +00:00
|
|
|
############ common to lms & cms
|
|
|
|
|
2017-07-03 10:39:19 +00:00
|
|
|
# Install system requirements
|
2017-12-26 00:16:35 +00:00
|
|
|
RUN apt update && \
|
|
|
|
apt upgrade -y && \
|
|
|
|
# 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++ && \
|
2018-04-12 13:45:59 +00:00
|
|
|
# openedx requirements
|
2018-04-21 10:41:04 +00:00
|
|
|
apt install -y 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 nodejs npm ntp pkg-config && \
|
2017-12-26 00:16:35 +00:00
|
|
|
# Our requirements
|
|
|
|
apt install -y mysql-client
|
2017-07-03 10:39:19 +00:00
|
|
|
|
|
|
|
# Install symlink so that we have access to 'node' binary without virtualenv.
|
|
|
|
# This replaces the "nodeenv" install.
|
|
|
|
RUN apt install -y nodejs-legacy
|
|
|
|
|
2018-12-07 18:30:30 +00:00
|
|
|
# Dockerize will be useful to wait for mysql DB availability
|
|
|
|
ENV DOCKERIZE_VERSION v0.6.1
|
|
|
|
RUN curl -L -o /tmp/dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
|
|
|
|
&& tar -C /usr/local/bin -xzvf /tmp/dockerize.tar.gz \
|
|
|
|
&& rm /tmp/dockerize.tar.gz
|
|
|
|
|
2018-11-28 18:57:17 +00:00
|
|
|
# Static assets will reside in /openedx/data, themes in /openedx/themes and
|
|
|
|
# edx-platform will be checked-out in /openedx/
|
|
|
|
RUN mkdir /openedx /openedx/data /openedx/themes /openedx/edx-platform
|
2017-07-03 10:39:19 +00:00
|
|
|
WORKDIR /openedx/edx-platform
|
2017-12-26 00:16:35 +00:00
|
|
|
|
|
|
|
## Checkout edx-platform code
|
2018-04-09 17:16:58 +00:00
|
|
|
ARG EDX_PLATFORM_REPOSITORY=https://github.com/edx/edx-platform.git
|
2018-10-02 06:36:29 +00:00
|
|
|
ARG EDX_PLATFORM_VERSION=open-release/hawthorn.2
|
2018-04-09 17:16:58 +00:00
|
|
|
RUN git clone $EDX_PLATFORM_REPOSITORY --branch $EDX_PLATFORM_VERSION --depth 1 .
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2018-12-07 18:30:30 +00:00
|
|
|
# Download extra locales to /openedx/locale
|
|
|
|
RUN cd /tmp \
|
|
|
|
&& curl -L -o openedx-i18n.tar.gz https://github.com/regisb/openedx-i18n/archive/hawthorn.tar.gz \
|
|
|
|
&& tar xzf /tmp/openedx-i18n.tar.gz \
|
|
|
|
&& mv openedx-i18n-hawthorn/edx-platform/locale/ /openedx/ \
|
|
|
|
&& rm -rf openedx-i18n*
|
|
|
|
|
|
|
|
# Copy convenient scripts
|
|
|
|
COPY ./bin/docker-entrypoint.sh /usr/local/bin/
|
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
# Install python requirements (clone source repos in a separate dir, otherwise
|
|
|
|
# will be overwritten when we mount edx-platform)
|
2018-10-01 17:18:01 +00:00
|
|
|
ENV NO_PYTHON_UNINSTALL 1
|
2018-04-09 17:16:58 +00:00
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/base.txt
|
2018-08-27 20:40:44 +00:00
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/development.txt
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2018-11-20 10:24:52 +00:00
|
|
|
# Install patched version of ora2
|
2018-11-25 21:24:25 +00:00
|
|
|
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
|
2018-11-20 10:24:52 +00:00
|
|
|
|
2018-02-07 07:22:04 +00:00
|
|
|
# Install nodejs requirements
|
2018-12-08 19:02:45 +00:00
|
|
|
RUN npm set progress=false \
|
|
|
|
&& npm install
|
2018-04-21 10:41:04 +00:00
|
|
|
ENV PATH ./node_modules/.bin:${PATH}
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2018-12-07 18:30:30 +00:00
|
|
|
# Install private requirements: this is useful for installing custom xblocks.
|
|
|
|
# In particular, to install xblocks from a private repository, clone the
|
|
|
|
# respositories to ./requirements on the host and add `-e ./myxblock/` to
|
|
|
|
# ./requirements/private.txt.
|
|
|
|
COPY ./requirements/ /openedx/requirements
|
|
|
|
RUN touch /openedx/requirements/private.txt \
|
2018-12-24 07:54:32 +00:00
|
|
|
&& pip install -r /openedx/requirements/private.txt
|
2018-11-20 10:24:34 +00:00
|
|
|
|
2018-05-16 17:02:44 +00:00
|
|
|
# Link configuration files to common /openedx/config folder, which should later
|
|
|
|
# be mounted as a volume. Note that this image will not be functional until
|
|
|
|
# config files have been mounted inside the container
|
2018-12-07 18:30:30 +00:00
|
|
|
RUN mkdir -p /openedx/config/universal/lms /openedx/config/universal/cms \
|
|
|
|
&& ln -s /openedx/config/universal/lms/ /openedx/edx-platform/lms/envs/universal \
|
|
|
|
&& ln -s /openedx/config/universal/cms/ /openedx/edx-platform/cms/envs/universal \
|
|
|
|
&& ln -s /openedx/config/lms.env.json /openedx/ \
|
|
|
|
&& ln -s /openedx/config/cms.env.json /openedx/ \
|
|
|
|
&& ln -s /openedx/config/lms.auth.json /openedx/ \
|
|
|
|
&& ln -s /openedx/config/cms.auth.json /openedx/
|
|
|
|
COPY settings/lms/*.py /openedx/config/universal/lms/
|
|
|
|
COPY settings/cms/*.py /openedx/config/universal/cms/
|
|
|
|
|
2018-12-25 18:32:05 +00:00
|
|
|
# Copy scripts
|
|
|
|
COPY ./bin /openedx/bin
|
|
|
|
ENV PATH /openedx/bin:${PATH}
|
|
|
|
|
2018-12-07 18:30:30 +00:00
|
|
|
# Collect production assets. By default, only assets from the default theme
|
|
|
|
# will be processed. This makes the docker image lighter and faster to build.
|
2018-12-14 11:59:32 +00:00
|
|
|
# Only the custom themes added to /openedx/themes will be compiled.
|
2018-12-07 18:30:30 +00:00
|
|
|
# Here, we don't run "paver update_assets" which is slow, compiles all themes
|
|
|
|
# and requires a complex settings file. Instead, we decompose the commands
|
|
|
|
# and run each one individually to collect the production static assets to
|
2018-12-24 07:54:32 +00:00
|
|
|
# /openedx/staticfiles.
|
|
|
|
RUN openedx-assets xmodule \
|
|
|
|
&& openedx-assets npm \
|
|
|
|
&& openedx-assets webpack --env=prod \
|
|
|
|
&& openedx-assets common
|
2018-12-07 18:30:30 +00:00
|
|
|
COPY ./themes/ /openedx/themes/
|
2018-12-24 07:54:32 +00:00
|
|
|
RUN openedx-assets themes \
|
|
|
|
&& openedx-assets collect --settings=universal.assets
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2017-12-26 00:16:35 +00:00
|
|
|
# service variant is "lms" or "cms"
|
2018-04-09 17:16:58 +00:00
|
|
|
ENV SERVICE_VARIANT lms
|
2018-05-16 17:02:44 +00:00
|
|
|
ENV SETTINGS universal.production
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-12-07 18:30:30 +00:00
|
|
|
# Entrypoint will fix permissions of all files and run commands as openedx
|
2018-04-09 17:16:58 +00:00
|
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
2017-07-03 10:39:19 +00:00
|
|
|
|
|
|
|
# Run server
|
|
|
|
EXPOSE 8000
|
2017-07-24 09:32:50 +00:00
|
|
|
CMD gunicorn --name ${SERVICE_VARIANT} --bind=0.0.0.0:8000 --max-requests=1000 ${SERVICE_VARIANT}.wsgi:application
|