Reduced number of Django Image layers by changing directory ownership with directory copying step.

This commit is contained in:
Arnav Choudhury 2020-09-05 14:16:31 +05:30
parent 1676d1ad54
commit 7dacf4995c

View File

@ -32,26 +32,26 @@ COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/production.txt \ RUN pip install --no-cache-dir -r /requirements/production.txt \
&& rm -rf /requirements && rm -rf /requirements
COPY ./compose/production/django/entrypoint /entrypoint COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint RUN chmod +x /entrypoint
RUN chown django /entrypoint
COPY ./compose/production/django/start /start
COPY --chown=django:django ./compose/production/django/start /start
RUN sed -i 's/\r$//g' /start RUN sed -i 's/\r$//g' /start
RUN chmod +x /start RUN chmod +x /start
RUN chown django /start
{%- if cookiecutter.use_celery == "y" %} {%- if cookiecutter.use_celery == "y" %}
COPY ./compose/production/django/celery/worker/start /start-celeryworker COPY --chown=django:django ./compose/production/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r$//g' /start-celeryworker RUN sed -i 's/\r$//g' /start-celeryworker
RUN chmod +x /start-celeryworker RUN chmod +x /start-celeryworker
RUN chown django /start-celeryworker
COPY ./compose/production/django/celery/beat/start /start-celerybeat
COPY --chown=django:django ./compose/production/django/celery/beat/start /start-celerybeat
RUN sed -i 's/\r$//g' /start-celerybeat RUN sed -i 's/\r$//g' /start-celerybeat
RUN chmod +x /start-celerybeat RUN chmod +x /start-celerybeat
RUN chown django /start-celerybeat
COPY ./compose/production/django/celery/flower/start /start-flower COPY ./compose/production/django/celery/flower/start /start-flower
RUN sed -i 's/\r$//g' /start-flower RUN sed -i 's/\r$//g' /start-flower