Skip to content

Commit

Permalink
Merge pull request #7 from edx/huniafatima/migrate-dockerfile-setup
Browse files Browse the repository at this point in the history
perf: optimised to handle dependecies cache
  • Loading branch information
huniafatima-arbi authored Oct 9, 2024
2 parents d84f139 + 4b9b613 commit 9cf2bb7
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions dockerfiles/registrar.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ 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 mkdir -p requirements

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

Expand All @@ -77,15 +75,27 @@ EXPOSE 18735

FROM app as dev

Check warning on line 76 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 76 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN pip install --no-cache-dir -r requirements/devstack.txt
# fetching the requirement file that is needed
RUN curl -L -o requirements/devstack.txt https://raw.githubusercontent.com/edx/registrar/master/requirements/devstack.txt

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

# 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

Check warning on line 86 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

Check warning on line 86 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

Legacy key/value format with whitespace separator should not be used

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format More info: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

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

Check warning on line 88 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

Check warning on line 88 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

FROM app as prod

Check warning on line 90 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 90 in dockerfiles/registrar.Dockerfile

View workflow job for this annotation

GitHub Actions / build-and-push-image

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN pip install --no-cache-dir -r ${REGISTRAR_CODE_DIR}/requirements/production.txt
# fetching the requirement file that is needed
RUN curl -L -o requirements/production.txt https://raw.githubusercontent.com/edx/registrar/master/requirements/production.txt

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

# 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 9cf2bb7

Please sign in to comment.