From 78097731eb5527628e467538abaa7f8bec395174 Mon Sep 17 00:00:00 2001 From: "Roland C. Dowdeswell" Date: Tue, 8 Feb 2022 16:11:17 +0000 Subject: [PATCH] utils/Dockerfile: make image smaller by adding --no-cache to the required invocations of `apk add` and `pip`. --- utils/Dockerfile | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/utils/Dockerfile b/utils/Dockerfile index d3929857b..b5c8b0890 100644 --- a/utils/Dockerfile +++ b/utils/Dockerfile @@ -3,22 +3,25 @@ ENV PYTHONUNBUFFERED=1 # # Note: we install build deps for pip, then remove everything after -# pip install. +# pip install. We also add `--no-cache` to pip and apk to reduce the +# size of the generated image. # # We re-install binutils at the end because Python execve(2)s ld(1) to # load zeromq. -RUN apk add --no-cache --virtual .build-deps gcc g++ python3-dev \ +RUN PIP="pip --no-cache install" \ + APK_ADD="apk add --no-cache"; \ + $APK_ADD --virtual .build-deps gcc g++ python3-dev \ libffi-dev musl-dev make \ - && apk add git libsodium-dev libsecp256k1-dev gmp-dev \ - && apk add zeromq-dev \ - && pip install base58 pynacl \ - && pip install pytezos requests \ - && pip install pyblake2 pysodium numpy flask \ - && pip install -e 'git+https://github.com/vbuterin/pybitcointools.git@aeb0a2bbb8bbfe421432d776c649650eaeb882a5#egg=bitcoin' \ + && $APK_ADD git libsodium-dev libsecp256k1-dev gmp-dev \ + && $APK_ADD zeromq-dev \ + && $PIP install base58 pynacl \ + && $PIP install pytezos requests \ + && $PIP install pyblake2 pysodium numpy flask \ + && $PIP install -e 'git+https://github.com/vbuterin/pybitcointools.git@aeb0a2bbb8bbfe421432d776c649650eaeb882a5#egg=bitcoin' \ && apk del .build-deps git \ - && apk add jq netcat-openbsd curl binutils \ - && apk add lz4 + && $APK_ADD jq netcat-openbsd curl binutils \ + && $APK_ADD lz4 COPY config-generator.py / COPY faucet-gen.py /