From a09150274fdea2a488092067fb4d4d181fc10ef2 Mon Sep 17 00:00:00 2001 From: Lucas Roesler Date: Tue, 6 Feb 2024 10:20:07 +0100 Subject: [PATCH] fix: ensure test layer is in the build DAG Some builders will exclude layers that do not contribute to the final target layer, meaning the `ship` layer for these templates. This means that the `test` layer is often optimized away by modern builders. We add the `test` layer as a dependency of the `ship` layer to ensure it is always run. Signed-off-by: Lucas Roesler --- template/python3-flask-debian/Dockerfile | 2 +- template/python3-flask/Dockerfile | 2 +- template/python3-http-debian/Dockerfile | 2 +- template/python3-http/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/template/python3-flask-debian/Dockerfile b/template/python3-flask-debian/Dockerfile index f0a245d..6086cf9 100644 --- a/template/python3-flask-debian/Dockerfile +++ b/template/python3-flask-debian/Dockerfile @@ -48,7 +48,7 @@ ARG TEST_ENABLED=true RUN [ "$TEST_ENABLED" = "false" ] && echo "skipping tests" || eval "$TEST_COMMAND" -FROM build as ship +FROM test as ship WORKDIR /home/app/ #configure WSGI server and healthcheck diff --git a/template/python3-flask/Dockerfile b/template/python3-flask/Dockerfile index 8235eba..748fbad 100644 --- a/template/python3-flask/Dockerfile +++ b/template/python3-flask/Dockerfile @@ -46,7 +46,7 @@ ARG TEST_COMMAND=tox ARG TEST_ENABLED=true RUN [ "$TEST_ENABLED" = "false" ] && echo "skipping tests" || eval "$TEST_COMMAND" -FROM build as ship +FROM test as ship WORKDIR /home/app/ #configure WSGI server and healthcheck diff --git a/template/python3-http-debian/Dockerfile b/template/python3-http-debian/Dockerfile index 99a6c42..db9fadf 100644 --- a/template/python3-http-debian/Dockerfile +++ b/template/python3-http-debian/Dockerfile @@ -44,7 +44,7 @@ ARG TEST_ENABLED=true RUN [ "$TEST_ENABLED" = "false" ] && echo "skipping tests" || eval "$TEST_COMMAND" -FROM build as ship +FROM test as ship WORKDIR /home/app/ USER app diff --git a/template/python3-http/Dockerfile b/template/python3-http/Dockerfile index 626d46c..8448c18 100644 --- a/template/python3-http/Dockerfile +++ b/template/python3-http/Dockerfile @@ -43,7 +43,7 @@ ARG TEST_COMMAND=tox ARG TEST_ENABLED=true RUN [ "$TEST_ENABLED" = "false" ] && echo "skipping tests" || eval "$TEST_COMMAND" -FROM build as ship +FROM test as ship WORKDIR /home/app/ # configure WSGI server and healthcheck