From 74892e45c5d88dd03ab262a29fe52d16269615f7 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Tue, 31 Jan 2023 19:58:17 +1300 Subject: [PATCH 1/2] chore: Use a single `COPY` by better leveraging `.dockerignore` patterns --- .dockerignore | 9 +++++++++ Dockerfile | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 7cd827c..bbc4f67 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,11 @@ +# Exclude everything from the Docker build context: +* + +# Except for this content: +!bin/ +!etc/ +!testssl.sh + +# But additionally exclude this nested content: bin/openssl.Darwin.* bin/openssl.FreeBSD.* diff --git a/Dockerfile b/Dockerfile index 2ccf505..49b3553 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,9 +12,8 @@ RUN apk update && \ USER testssl WORKDIR /home/testssl/ -COPY --chown=testssl:testssl etc/. /home/testssl/etc/ -COPY --chown=testssl:testssl bin/. /home/testssl/bin/ -COPY --chown=testssl:testssl testssl.sh /home/testssl/ +# Copy over build context (after filtered by .dockerignore): bin/ etc/ testssl.sh +COPY --chown=testssl . /home/testssl/ ENTRYPOINT ["testssl.sh"] From 81634ce13d42c3704301795a6392e3baac80765a Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Tue, 7 Feb 2023 21:36:47 +1300 Subject: [PATCH 2/2] chore: Bring back group value for `COPY --chown` --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 49b3553..ace017a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ USER testssl WORKDIR /home/testssl/ # Copy over build context (after filtered by .dockerignore): bin/ etc/ testssl.sh -COPY --chown=testssl . /home/testssl/ +COPY --chown=testssl:testssl . /home/testssl/ ENTRYPOINT ["testssl.sh"]