Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
fix: some improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
aht007 committed Aug 22, 2022
1 parent a51e0c0 commit a84c4cb
Showing 1 changed file with 32 additions and 23 deletions.
55 changes: 32 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
FROM ubuntu:focal as app

RUN apt-get update && apt-get upgrade -y
RUN apt update && \
apt-get install -y software-properties-common && \
apt-add-repository -y ppa:deadsnakes/ppa && apt-get update && \
apt-get install -y curl && \
apt-get install -y vim && \
apt-get upgrade -qy && \
apt install -y git-core language-pack-en build-essential python3.8-dev python3-virtualenv \
python3.8-distutils libmysqlclient-dev libssl-dev gettext && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python3.8 get-pip.py && python3.8 -m pip install --upgrade pip setuptools && \
curl \
vim \
git-core \
language-pack-en \
build-essential \
python3.8-dev \
python3-virtualenv \
python3.8-distutils \
libmysqlclient-dev \
libssl-dev \
gettext && \
rm -rf /var/lib/apt/lists/*

RUN locale-gen en_US.UTF-8
Expand All @@ -21,9 +24,6 @@ ENV LC_ALL en_US.UTF-8
ARG COMMON_CFG_DIR "/edx/etc"
ARG INSIGHTS_CFG_DIR "${COMMON_CFG_DIR}/insights"
ARG ANALYTICS_DASHBOARD_CFG "${COMMON_CFG_DIR}/insights.yml"
# DJANGO_SETTINGS_MODULE was defined previously in `insights-env` file and sourced from there while running the devstack. To me it makes more sense to define
# this variable within the Dockerfile and it will also eliminate the use of two different files(devstack-env, production-env)
ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.production"
ENV ANALYTICS_DASHBOARD_CFG "${ANALYTICS_DASHBOARD_CFG}"

ARG COMMON_APP_DIR="/edx/app"
Expand Down Expand Up @@ -72,7 +72,7 @@ RUN . ${SUPERVISOR_VENV_BIN}/activate && \

# create supervisor job
COPY /configuration_files/supervisor.conf /etc/systemd/system/supervisor.service
# These files are already present in the current insights image but do we have a reasonable use case of these files or should they be delete...?
# These files are already present in the current insights image but do we have a reasonable use case of these files or should they be deleted...?
# COPY /configuration_files/lms.conf ${SUPERVISOR_CFG_DIR}/lms.conf
# COPY /configuration_files/cms.conf ${SUPERVISOR_CFG_DIR}/cms.conf
COPY /configuration_files/supervisorctl ${SUPERVISOR_VENV_BIN}/supervisorctl
Expand All @@ -99,28 +99,37 @@ RUN webpack --config webpack.prod.config.js
RUN python3 manage.py collectstatic --noinput

# Enable supervisor script
COPY /scripts/insights.sh /edx/app/insights/insights.sh
COPY /scripts/insights.sh ${INSIGHTS_APP_DIR}/insights.sh
COPY /configuration_files/insights.conf ${SUPERVISOR_AVAILABLE_DIR}/insights.conf
COPY /configuration_files/insights.conf ${SUPERVISOR_CFG_DIR}/insights.conf
# Manage.py symlink
COPY /manage.py /edx/bin/manage.insights

COPY scripts/devstack.sh /edx/app/insights/devstack.sh
COPY /configuration_files/insights-env ${INSIGHTS_APP_DIR}/insights_env

RUN chown insights:insights /edx/app/insights/devstack.sh && chmod a+x /edx/app/insights/devstack.sh
ENTRYPOINT ["/edx/app/insights/devstack.sh"]
CMD ["start"]

EXPOSE 8110
EXPOSE 18110

USER insights

FROM app as dev
FROM app as production

ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.devstack"
# DJANGO_SETTINGS_MODULE was defined previously in `insights-env` file and sourced from there while running the devstack. To me it makes more sense to define
# this variable within the Dockerfile and it will also eliminate the use of two different files(devstack-env, production-env)
ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.production"

ENTRYPOINT ["${REGISTRAR_APP_DIR}/insights.sh"]

FROM app as dev

RUN . ${INSIGHTS_VENV_DIR}/bin/activate && \
pip install -r ${INSIGHTS_CODE_DIR}/requirements/local.txt && \
deactivate

ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.devstack"

COPY scripts/devstack.sh ${INSIGHTS_APP_DIR}/devstack.sh
COPY /configuration_files/insights-env ${INSIGHTS_APP_DIR}/insights_env

RUN chown insights:insights ${INSIGHTS_APP_DIR}/devstack.sh && chmod a+x ${INSIGHTS_APP_DIR}/devstack.sh
ENTRYPOINT ["${INSIGHTS_APP_DIR}/devstack.sh"]

CMD ["start"]

0 comments on commit a84c4cb

Please sign in to comment.