Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1477,4 +1477,4 @@ guidance and advice.

- Jannis Leidel
- Nate Aune
- Barry Morrison
- Barry Morrison
48 changes: 35 additions & 13 deletions {{cookiecutter.project_slug}}/compose/production/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,37 @@ RUN npm install && npm cache clean --force
COPY . /app
RUN npm run build

# Python build stage
{%- endif %}
FROM python:3.8-slim-buster

ENV PYTHONUNBUFFERED 1
# Python build stage
FROM python:3.8-slim-buster as python-build-stage

COPY ./requirements /requirements


RUN apt-get update \
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
&& apt-get install -y build-essential \
build-essential \
# psycopg2 dependencies
&& apt-get install -y libpq-dev \
libpq-dev \
# Translations dependencies
&& apt-get install -y gettext \
gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* \
# install python dependencies
&& pip install --no-cache-dir -r /requirements/production.txt \
&& rm -rf /requirements


# Python 'run' stage
FROM python:3.8-slim-buster

ENV PYTHONUNBUFFERED 1

RUN addgroup --system django \
&& adduser --system --ingroup django django

# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN pip install --no-cache-dir -r /requirements/production.txt \
&& rm -rf /requirements

COPY --chown=django:django ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint
RUN chmod +x /entrypoint
Expand All @@ -58,6 +64,22 @@ RUN sed -i 's/\r$//g' /start-flower
RUN chmod +x /start-flower
{%- endif %}

# installing required system dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
# psycopg2 dependencies
libpq-dev \
# Translations dependencies
gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*


COPY --from=python-build-stage /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
COPY --from=python-build-stage /usr/local/bin/ /usr/local/bin/



{%- if cookiecutter.js_task_runner == 'Gulp' %}
COPY --from=client-builder --chown=django:django /app /app
{% else %}
Expand Down