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
|
2017-12-26 00:16:35 +00:00
|
|
|
apt install -y gettext gfortran graphviz graphviz-dev libffi-dev libfreetype6-dev libgeos-dev libjpeg8-dev liblapack-dev libpng12-dev libxml2-dev libxmlsec1-dev libxslt1-dev nodejs npm ntp pkg-config && \
|
|
|
|
# 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
|
|
|
|
|
2017-07-24 09:32:50 +00:00
|
|
|
# Static assets will reside in /openedx/data and edx-platform will be
|
2017-12-26 00:16:35 +00:00
|
|
|
# checked-out in /openedx/
|
|
|
|
RUN mkdir /openedx /openedx/data /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
|
|
|
|
ARG EDX_PLATFORM_VERSION=open-release/ginkgo.master
|
|
|
|
RUN git clone $EDX_PLATFORM_REPOSITORY --branch $EDX_PLATFORM_VERSION --depth 1 .
|
2017-07-03 10:39:19 +00:00
|
|
|
|
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)
|
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/pre.txt
|
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/github.txt
|
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/local.txt
|
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/base.txt
|
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/post.txt
|
|
|
|
RUN pip install --src ../venv/src -r requirements/edx/paver.txt
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2018-02-07 07:22:04 +00:00
|
|
|
# Install nodejs requirements
|
|
|
|
RUN npm install
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2017-12-26 00:16:35 +00:00
|
|
|
# Copy configuration files
|
2017-07-24 09:32:50 +00:00
|
|
|
COPY ./config/production_lms.py /openedx/edx-platform/lms/envs/production.py
|
|
|
|
COPY ./config/production_cms.py /openedx/edx-platform/cms/envs/production.py
|
2017-12-26 00:16:35 +00:00
|
|
|
COPY ./config/production_common.py /openedx/edx-platform/lms/envs/production_common.py
|
|
|
|
COPY ./config/production_common.py /openedx/edx-platform/cms/envs/production_common.py
|
|
|
|
COPY ./config/lms.env.json /openedx/
|
|
|
|
COPY ./config/cms.env.json /openedx/
|
|
|
|
COPY ./config/lms.auth.json /openedx/
|
|
|
|
COPY ./config/cms.auth.json /openedx/
|
2017-07-24 09:32:50 +00:00
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
# Copy convenient scripts
|
|
|
|
COPY ./wait-for-greenlight.sh /usr/local/bin/
|
|
|
|
COPY ./docker-entrypoint.sh /usr/local/bin/
|
2017-07-03 10:39:19 +00:00
|
|
|
|
2018-04-19 19:20:58 +00:00
|
|
|
# Declare volumes as late as possible, otherwise steps that modify these
|
|
|
|
# folders are discarded
|
|
|
|
VOLUME /openedx/data
|
|
|
|
VOLUME /openedx/edx-platform
|
|
|
|
|
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
|
|
|
|
ENV SETTINGS production
|
2017-12-26 00:16:35 +00:00
|
|
|
|
2018-04-09 17:16:58 +00:00
|
|
|
# Entrypoint will fix permissiosn of all files and run commands as openedx
|
|
|
|
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
|