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 23, 2022
1 parent a84c4cb commit 2186d96
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM ubuntu:focal as app

RUN apt-get update && apt-get upgrade -y
RUN apt update && \
ENV DEBIAN_FRONTEND noninteractive

RUN apt update && apt-get install -qy \
curl \
vim \
git-core \
Expand All @@ -28,6 +29,7 @@ ENV ANALYTICS_DASHBOARD_CFG "${ANALYTICS_DASHBOARD_CFG}"

ARG COMMON_APP_DIR="/edx/app"
ARG INSIGHTS_APP_DIR="${COMMON_APP_DIR}/insights"
ENV INSIGHTS_APP_DIR ${INSIGHTS_APP_DIR}
ARG SUPERVISOR_APP_DIR="${COMMON_APP_DIR}/supervisor"
ARG INSIGHTS_VENV_DIR="${COMMON_APP_DIR}/insights/venvs/insights"
ARG SUPERVISOR_VENVS_DIR="${SUPERVISOR_APP_DIR}/venvs"
Expand Down Expand Up @@ -80,7 +82,6 @@ COPY /configuration_files/supervisorctl ${SUPERVISOR_VENV_BIN}/supervisorctl
# insights service config commands below
RUN pip install -r ${INSIGHTS_CODE_DIR}/requirements/production.txt


RUN nodeenv ${INSIGHTS_NODEENV_DIR} --node=${INSIGHTS_NODE_VERSION} --prebuilt
RUN npm install -g npm@${INSIGHTS_NPM_VERSION}

Expand All @@ -94,10 +95,6 @@ RUN npm set progress=false && npm ci

COPY configuration_files/insights.yml /edx/etc/insights.yml

# Should we run the static assets related step within the dockerfile or delegate these to provisioning steps of devstack...?
RUN webpack --config webpack.prod.config.js
RUN python3 manage.py collectstatic --noinput

# Enable supervisor script
COPY /scripts/insights.sh ${INSIGHTS_APP_DIR}/insights.sh
COPY /configuration_files/insights.conf ${SUPERVISOR_AVAILABLE_DIR}/insights.conf
Expand All @@ -108,28 +105,31 @@ COPY /manage.py /edx/bin/manage.insights
EXPOSE 8110
EXPOSE 18110

USER insights

FROM app as production

# 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"]
# For devstack these are run from the provisioning steps and hence no need for them in the dev target.
RUN webpack --config webpack.prod.config.js
RUN python3 manage.py collectstatic --noinput

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

FROM app as dev

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

ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.devstack"

COPY scripts/devstack.sh ${INSIGHTS_APP_DIR}/devstack.sh
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"]


ENTRYPOINT ["/edx/app/insights/devstack.sh"]

CMD ["start"]

0 comments on commit 2186d96

Please sign in to comment.