Changed when Requirements are copied and installed to improve incremental image build times. The extra image layer is inconsequential since python-build-stage layers are discarded anyway.

This commit is contained in:
Arnav Choudhury 2020-09-14 01:41:33 +05:30
parent 99ef9f44b9
commit 079db28661
3 changed files with 18 additions and 17 deletions

View File

@ -2,9 +2,6 @@
FROM python:3.8-slim-buster as python-build-stage
ENV PYTHONDONTWRITEBYTECODE 1
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
@ -14,15 +11,19 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
# install python dependencies
&& pip install --no-cache-dir --use-feature=2020-resolver -r /requirements/local.txt \
&& rm -rf /var/lib/apt/lists/*
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
# install python dependencies
RUN pip install --no-cache-dir --use-feature=2020-resolver -r /requirements/local.txt \
&& rm -rf /requirements
# Python 'run' stage
FROM python:3.8-slim-buster
FROM python:3.8-slim-buster as python-run-stage
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

View File

@ -13,9 +13,6 @@ RUN npm run build
FROM python:3.8-slim-buster as python-build-stage
ENV PYTHONDONTWRITEBYTECODE 1
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
build-essential \
@ -25,14 +22,17 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
gettext \
# cleaning up unused files
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
# install python dependencies
&& pip install --no-cache-dir --use-feature=2020-resolver -r /requirements/production.txt \
&& rm -rf /var/lib/apt/lists/*
# Requirements are installed here to ensure they will be cached.
COPY ./requirements /requirements
# install python dependencies
Run pip install --no-cache-dir --use-feature=2020-resolver -r /requirements/production.txt \
&& rm -rf /requirements
# Python 'run' stage
FROM python:3.8-slim-buster
FROM python:3.8-slim-buster as python-run-stage
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

View File

@ -1,4 +1,4 @@
FROM traefik:v2.0
FROM traefik:v2.2.11
RUN mkdir -p /etc/traefik/acme \
&& touch /etc/traefik/acme/acme.json \
&& chmod 600 /etc/traefik/acme/acme.json