From b6dd4130e6935fc41e29ab05e340dac1b3a0065c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Fri, 27 Apr 2018 23:33:48 +0200 Subject: [PATCH] Load config files as mounted volumes This allows changing the openedx config without rebuilding the image. --- docker-compose.yml | 4 ++++ openedx/Dockerfile | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 25c163f..0f09386 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -58,6 +58,7 @@ services: SERVICE_VARIANT: lms restart: unless-stopped volumes: + - ./openedx/config:/openedx/config - ./data/lms:/openedx/data depends_on: - memcached @@ -73,6 +74,7 @@ services: SERVICE_VARIANT: cms restart: unless-stopped volumes: + - ./openedx/config:/openedx/config - ./data/cms:/openedx/data depends_on: - memcached @@ -94,6 +96,7 @@ services: environment: C_FORCE_ROOT: "1" # run celery tasks as root #nofear volumes: + - ./openedx/config:/openedx/config - ./data/lms_worker:/openedx/data depends_on: - lms @@ -108,6 +111,7 @@ services: environment: C_FORCE_ROOT: "1" # run celery tasks as root #nofear volumes: + - ./openedx/config:/openedx/config - ./data/cms_worker:/openedx/data depends_on: - cms diff --git a/openedx/Dockerfile b/openedx/Dockerfile index f5cc997..963c75b 100644 --- a/openedx/Dockerfile +++ b/openedx/Dockerfile @@ -38,15 +38,17 @@ RUN pip install --src ../venv/src -r requirements/edx/paver.txt # Install nodejs requirements RUN npm install -# Copy configuration files -COPY ./config/production_lms.py /openedx/edx-platform/lms/envs/production.py -COPY ./config/production_cms.py /openedx/edx-platform/cms/envs/production.py -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/ +# Copy configuration files in common folder (which can later be mounted as a volume) +RUN mkdir /openedx/config +COPY ./config/* /openedx/config/ +RUN ln -s /openedx/config/production_lms.py /openedx/edx-platform/lms/envs/production.py \ + && ln -s /openedx/config/production_cms.py /openedx/edx-platform/cms/envs/production.py \ + && ln -s /openedx/config/production_common.py /openedx/edx-platform/lms/envs/production_common.py \ + && ln -s /openedx/config/production_common.py /openedx/edx-platform/cms/envs/production_common.py +RUN 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 convenient scripts COPY ./wait-for-greenlight.sh /usr/local/bin/