From c3303b04efe00e4dee0d44ae6781a219aeaa0489 Mon Sep 17 00:00:00 2001 From: Dakoda Greaves Date: Sat, 11 Dec 2021 13:56:12 -0800 Subject: [PATCH] refactor/copy-archive refined Dockerfile by extracting the specific files we need from our archive and copying each while setting appropriate owner:group. --- 1.14.5/bullseye/Dockerfile | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/1.14.5/bullseye/Dockerfile b/1.14.5/bullseye/Dockerfile index af2c8bc..c6920f7 100644 --- a/1.14.5/bullseye/Dockerfile +++ b/1.14.5/bullseye/Dockerfile @@ -53,7 +53,13 @@ RUN set -ex && ARCHITECTURE=$(dpkg --print-architecture) \ | grep OK | shuf -n 1 | sed s/:.*// > random_signer.txt \ && grep ${RLS_FILE_NAME} sigs/${SIG_PATH}/$(cat random_signer.txt)/*assert | sha256sum -c \ && grep ${RLS_FILE_NAME} SHASUMS | sha256sum -c \ - && mv ${RLS_FILE_NAME} dogecoin.tar.gz + && tar -zxvf ${RLS_FILE_NAME} \ + dogecoin-${RLS_VERSION}/bin/dogecoind \ + dogecoin-${RLS_VERSION}/bin/dogecoin-cli \ + dogecoin-${RLS_VERSION}/bin/dogecoin-tx \ + --strip-components=1 + +COPY entrypoint.py /entrypoint.py FROM debian:bullseye-slim AS final @@ -65,20 +71,18 @@ ENV HOME=/${USER} RUN useradd ${USER} --home-dir ${HOME} -WORKDIR /tmp - -# Copy the downloaded binary from the verify stage -COPY --from=verify /verify/dogecoin.tar.gz ./ - -# Move downloaded binaries and man pages in the container system. +WORKDIR ${HOME} +# Copy the downloaded binaries and man pages into the container system from the verify stage. # Setuid on binaries with $USER rights, to limit root usage. -RUN tar -xvf dogecoin.tar.gz --strip-components=1 \ - && cp bin/dogecoind bin/dogecoin-cli bin/dogecoin-tx /usr/local/bin/ \ - && chown ${USER}:${USER} /usr/local/bin/dogecoin* \ - && chmod 4555 /usr/local/bin/dogecoin* \ - && rm -rf * +COPY --from=verify --chown=${USER}:${USER} \ + /verify/bin/dogecoind \ + /verify/bin/dogecoin-cli \ + /verify/bin/dogecoin-tx \ + /entrypoint.py /usr/local/bin/ -WORKDIR ${HOME} +# Set permissions on copied files +RUN chmod 4555 /usr/local/bin/dogecoin* \ + && chmod 500 /usr/local/bin/entrypoint.py # P2P network (mainnet, testnet & regnet respectively) EXPOSE 22556 44556 18444 @@ -93,8 +97,5 @@ RUN apt update && apt install --no-install-recommends -y \ python3 \ && rm -rf /var/lib/apt/lists/* -COPY entrypoint.py /usr/local/bin/entrypoint.py -RUN chmod 500 /usr/local/bin/entrypoint.py - ENTRYPOINT ["entrypoint.py"] CMD ["dogecoind"]