Files
edx-platform/Dockerfile
Kyle McCormick b24cb48eb0 Decentralized Devstack changes: Add and push Dockerfile; add decentralized devstack settings (#24666)
* Add and push Dockerfile; add decentralized devstack settings

Co-Authored-By: Diana Huang <dkh@edx.org>
Co-Authored-By: Kyle McCormick <kmccormick@edx.org>

* Remove Python requirements hack

Remove the attempted optimization to the installation of Python
package dependencies.  The dependencies in edx-platform change
about three times per day, so this was of dubious value.  And
because npm is run through nodeenv, which is a Python package,
the Python dependencies installation has to happen first.

* ARCHBOM-1439: Changing workdir to /edx/app/edxapp/edx-platform (#24835)

Context: The Dockerfile tries to stay in sych with legacy stuff.
In the ansible we configure the directory structure such that things
relating to the app but not in the codebase,
such as the env file wind up in /edx/app/edxapp/.
And the codebase winds up in /edx/app/edxapp/edx-platform.

I think due to accident, the dockerfile does
/edx/app/edx-platform/edx-platform instead of /edx/app/edxapp/edx-platform.

This commit tries to have Dockerfile more reflect what is currently happening in production

* Update ports for decentralized devstack ARCHBOM-1447 (#24841)

Switch from the LMS ports we've historically used for NGINX to those used for gunicorn, and fix the Studio ports to match the ones we've historically used for its gunicorn service. Also removed some leftover bits of the requirements hack.

Co-authored-by: Adam Blackwell <ablackwell@edx.org>
Co-authored-by: Diana Huang <dkh@edx.org>
Co-authored-by: jinder1s <msingh@edx.org>
Co-authored-by: Jeremy Bowman <jbowman@edx.org>
Co-authored-by: Manjinder Singh <49171515+jinder1s@users.noreply.github.com>
2020-09-03 11:47:08 -04:00

127 lines
4.0 KiB
Docker

FROM ubuntu:xenial as base
# Warning: This file is experimental.
# Install system requirements
RUN apt-get update && \
# Global requirements
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
build-essential \
curl \
# If we don't need gcc, we should remove it.
g++ \
gcc \
git \
git-core \
language-pack-en \
libfreetype6-dev \
libmysqlclient-dev \
libssl-dev \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
software-properties-common \
swig \
# openedx requirements
gettext \
gfortran \
graphviz \
libffi-dev \
libfreetype6-dev \
libgeos-dev \
libgraphviz-dev \
libjpeg8-dev \
liblapack-dev \
libpng-dev \
libsqlite3-dev \
libxml2-dev \
libxmlsec1-dev \
libxslt1-dev \
ntp \
pkg-config \
python3-dev \
python3-pip \
python3.5 \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN ln -s /usr/bin/pip3 /usr/bin/pip
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /edx/app/edxapp/edx-platform
ENV PATH /edx/app/edxapp/nodeenv/bin:${PATH}
ENV PATH ./node_modules/.bin:${PATH}
ENV CONFIG_ROOT /edx/etc/
ENV PATH /edx/app/edxapp/edx-platform/bin:${PATH}
ENV SETTINGS production
RUN mkdir -p /edx/etc/
# Install Python requirements
RUN pip install pip==20.0.2
COPY setup.py setup.py
COPY common common
COPY openedx openedx
COPY lms lms
COPY cms cms
COPY requirements/edx/base.txt requirements/edx/base.txt
RUN pip install -r requirements/edx/base.txt
# Copy just JS requirements and install them.
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN nodeenv /edx/app/edxapp/nodeenv --node=12.11.1 --prebuilt
RUN npm set progress=false && npm install
ENV LMS_CFG /edx/etc/lms.yml
ENV STUDIO_CFG /edx/etc/studio.yml
COPY lms/devstack.yml /edx/etc/lms.yml
COPY cms/devstack.yml /edx/etc/studio.yml
# Copy over remaining code.
# We do this as late as possible so that small changes to the repo don't bust
# the requirements cache.
COPY . .
FROM base as lms
ENV SERVICE_VARIANT lms
ENV DJANGO_SETTINGS_MODULE lms.envs.production
EXPOSE 8000
CMD gunicorn -c /edx/app/edxapp/edx-platform/lms/docker_lms_gunicorn.py --name lms --bind=0.0.0.0:8000 --max-requests=1000 --access-logfile - lms.wsgi:application
FROM lms as lms-newrelic
RUN pip install newrelic
CMD newrelic-admin run-program gunicorn -c /edx/app/edxapp/edx-platform/lms/docker_lms_gunicorn.py --name lms --bind=0.0.0.0:8000 --max-requests=1000 --access-logfile - lms.wsgi:application
FROM lms as lms-devstack
# TODO: This compiles static assets.
# However, it's a bit of a hack, it's slow, and it's inefficient because makes the final Docker cache layer very large.
# We ought to be able to this higher up in the Dockerfile, and do it the same for Prod and Devstack.
RUN mkdir -p test_root/log
ENV DJANGO_SETTINGS_MODULE ""
RUN NO_PREREQ_INSTALL=1 paver update_assets lms --settings devstack_decentralized
ENV DJANGO_SETTINGS_MODULE lms.envs.devstack_decentralized
FROM base as studio
ENV SERVICE_VARIANT cms
ENV DJANGO_SETTINGS_MODULE cms.envs.production
EXPOSE 8010
CMD gunicorn -c /edx/app/edxapp/edx-platform/cms/docker_cms_gunicorn.py --name cms --bind=0.0.0.0:8010 --max-requests=1000 --access-logfile - cms.wsgi:application
FROM studio as studio-newrelic
RUN pip install newrelic
CMD newrelic-admin run-program gunicorn -c /edx/app/edxapp/edx-platform/cms/docker_cms_gunicorn.py --name cms --bind=0.0.0.0:8010 --max-requests=1000 --access-logfile - cms.wsgi:application
FROM studio as studio-devstack
# TODO: This compiles static assets.
# However, it's a bit of a hack, it's slow, and it's inefficient because makes the final Docker cache layer very large.
# We ought to be able to this higher up in the Dockerfile, and do it the same for Prod and Devstack.
RUN mkdir -p test_root/log
ENV DJANGO_SETTINGS_MODULE ""
RUN NO_PREREQ_INSTALL=1 paver update_assets cms --settings devstack_decentralized
ENV DJANGO_SETTINGS_MODULE cms.envs.devstack_decentralized