You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 15, 2019. It is now read-only.
One way to reduce the final size of the image is to start from a more minimal base. There are alpine builds that can help with this, but it might mean there's a bunch of different setup to be done for databases etc, or it might be impossible to have the same support with alpine. See below for an edited version of an alpine based build I use in a work project:
FROM python:3.6-alpine
ENV PYTHONUNBUFFERED 1
WORKDIR /code
# Different for alpineRUN addgroup -g 1000 -S django \
&& adduser -u 1000 -S django -G django \
&& mkdir -p /etc/ /code/webstatic/collectedstatic /code/webstatic/usermedia \
&& pip install pipenv
COPY Pipfile* /code/
# virtual "groups" packages together so they can be removed as a unitRUN apk update \
&& apk add --virtual build-deps make gcc python3-dev musl-dev libffi-dev \
&& apk add postgresql-dev nodejs nodejs-npm \
&& pipenv install --ignore-pipfile --system \
&& npm install \
&& apk del build-deps
# Production specific belowCOPY other files
USER django:django
ENTRYPOINT [ "docker-entrypoint.sh" ]
Then there's the possibility of using build files and copy-from to further reduce the final image size.