Skip to content

Commit

Permalink
perf: optimised to handle dependecies cache
Browse files Browse the repository at this point in the history
  • Loading branch information
huniafatima-arbi committed Oct 4, 2024
1 parent fcbfd84 commit fd8887e
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions dockerfiles/registrar.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,42 @@ ENV REGISTRAR_CODE_DIR ${REGISTRAR_CODE_DIR}
# Working directory will be root of repo.
WORKDIR ${REGISTRAR_CODE_DIR}

# cloning git repo
RUN curl -L https://github.com/edx/registrar/archive/refs/heads/master.tar.gz | tar -xz --strip-components=1


RUN virtualenv -p python${PYTHON_VERSION} --always-copy ${REGISTRAR_VENV_DIR}

RUN pip install --upgrade pip setuptools

ENV REGISTRAR_CFG="${COMMON_CFG_DIR}/registrar.yml"

# extracting requirements folder initially
RUN curl -L https://github.com/edx/registrar/archive/refs/heads/master/requirements.tar.gz | tar -xz --strip-components=1

# Expose ports.
EXPOSE 18734
EXPOSE 18735

FROM app as dev

RUN pip install --no-cache-dir -r requirements/devstack.txt
RUN pip install --no-cache-dir -r ${REGISTRAR_CODE_DIR}/requirements/devstack.txt

# removing extra requirements folder
RUN rm -rf requirements

# cloning the repository after requirements installation
RUN curl -L https://github.com/edx/registrar/archive/refs/heads/master.tar.gz | tar -xz --strip-components=1

ENV DJANGO_SETTINGS_MODULE registrar.settings.devstack

CMD while true; do python ./manage.py runserver 0.0.0.0:18734; sleep 2; done

FROM app as prod

RUN pip install --no-cache-dir -r ${REGISTRAR_CODE_DIR}/requirements/production.txt
RUN pip install --no-cache-dir -r ${REGISTRAR_CODE_DIR}/requirements/production.txt

# removing extra requirements folder
RUN rm -rf requirements

# cloning the repository after requirements installation
RUN curl -L https://github.com/edx/registrar/archive/refs/heads/master.tar.gz | tar -xz --strip-components=1

ENV DJANGO_SETTINGS_MODULE registrar.settings.production

Expand Down

0 comments on commit fd8887e

Please sign in to comment.