From 624f9ef98cd97fcd7eb82cc0633465f3934f2322 Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Thu, 16 Nov 2023 13:06:30 +0100 Subject: [PATCH] Dockerfile: combine run statements Docker creates one layer per RUN statement, so combine consecutive RUN statements into a single statement. --- Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 165045e27..fe775566c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,9 +29,8 @@ RUN apt-get update && \ ARG ENVIRONMENT=deployment # ARG ENVIRONMENT=test -RUN echo "Environment is: $ENVIRONMENT" - -RUN pip install pip-tools pytest-cov +RUN echo "Environment is: $ENVIRONMENT" && \ + pip install pip-tools pytest-cov # Set up a nice workdir and add the live code ENV APPDIR=/code @@ -46,9 +45,8 @@ RUN if [ "$ENVIRONMENT" = "deployment" ] ; then\ rm -rf /code/* /code/.git* ; \ else \ pip install --editable .[$ENVIRONMENT]; \ - fi - -RUN pip freeze + fi && \ + pip freeze ENTRYPOINT ["/bin/tini", "--"]