I have a very minimalist Dockerfile
for my production Django application:
FROM python:3.8
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
RUN apt-get update &&
apt-get -y upgrade
WORKDIR /app
COPY requirements.txt ./
RUN pip install --upgrade pip && \
pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD [ "gunicorn", "api.wsgi:application", "--bind=0.0.0.0" ]
Do I need to run apt-get update && apt-get -y upgrade
? From my understanding, the two commands (1) download the latest listing of available packages and (2) upgrade already installed packages. Why does the official python docker image not do this already?
If I don't need to run them in this minimalist Dockerfile, when do I need to run them? I've noticed they're commonly run when installing other packages.