From de7c6b37623464579794dcfb00db0ff106c7dc82 Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Sat, 13 Mar 2021 20:08:19 +0000 Subject: Dockerfile optimisations Copies dependencies before code for caching and removes git dependency. --- Dockerfile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'Dockerfile') diff --git a/Dockerfile b/Dockerfile index 44567b8a..5d8ba5da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,25 +8,20 @@ ENV PIP_NO_CACHE_DIR=false \ PIPENV_HIDE_EMOJIS=1 \ PIPENV_NOSPIN=1 -# Install git -RUN apt-get -y update \ - && apt-get install -y \ - git \ - && rm -rf /var/lib/apt/lists/* - -# Create non-root user. -RUN useradd --system --shell /bin/false --uid 1500 pysite - # Install pipenv RUN pip install -U pipenv # Copy the project files into working directory WORKDIR /app -COPY . . + +# Copy dependency files +COPY Pipfile Pipfile.lock ./ # Install project dependencies RUN pipenv install --system --deploy +# Copy project code +COPY . . # Set Git SHA environment variable ARG git_sha="development" -- cgit v1.2.3