From 676b67e8e15af447735a75346b6cb1b81f834f2b Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sat, 18 Apr 2020 09:30:31 +0200 Subject: [PATCH] Changing the order and breaking commands so that the cache can be used when the code is updated (huge Docker build time gain when rebuilding after a code update). --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 062bbbe..d42be2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,16 @@ FROM python:3-alpine MAINTAINER Jeffrey Forman WORKDIR /code -COPY . /code/ RUN apk add --no-cache nsd build-base python3-dev libffi-dev openssl-dev libc-dev libxslt-dev mariadb-connector-c-dev \ - && pip install --upgrade pip \ - && pip install --no-cache-dir -r requirements.txt + && pip install --upgrade pip + +COPY requirements.txt /code/ + +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /code/ + EXPOSE 8000