From 2186d966131ce7583e4ffbc8ffeb6ab21da0da95 Mon Sep 17 00:00:00 2001 From: Mohammad Ahtasham ul Hassan Date: Tue, 23 Aug 2022 14:35:24 +0500 Subject: [PATCH] fix: some improvements --- Dockerfile | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2915e7c7f..f002f21b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ @@ -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" @@ -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} @@ -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 @@ -108,7 +105,6 @@ COPY /manage.py /edx/bin/manage.insights EXPOSE 8110 EXPOSE 18110 -USER insights FROM app as production @@ -116,20 +112,24 @@ FROM app as production # 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"]