From 134523d2dae95606cd8d44459ded1ad0695e46d7 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 25 Nov 2018 21:13:44 +0100 Subject: [PATCH] Multistage build. --- Dockerfile | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ddf370e..e9f4f79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,47 @@ -FROM python:3.6-alpine +FROM python:3.6-alpine as base RUN apk add --no-cache --virtual .build-deps \ git make gcc musl-dev asciidoc \ \ # Install deps && pip install snakeoil \ - && pip install git+https://github.com/dol-sen/pyDeComp \ \ # Clone catalyst repository && git clone https://anongit.gentoo.org/git/proj/catalyst.git catalyst \ \ # Build and install catalyst - && cd catalyst \ + && cd /catalyst \ && make \ && python -m setup install \ \ + # Get shash + cd / \ + && wget ftp://mcrypt.hellug.gr/pub/mcrypt/shash/shash-0.2.6.tar.gz \ + && tar xvzf shash-0.2.6.tar.gz \ + && cd shash-0.2.6 && make && make install \ + \ # Cleanup - && cd .. \ + && cd / \ && rm -Rf catalyst \ && apk del .build-deps -RUN apk add coreutils rhash +FROM python:3.6-alpin as base + +RUN apk add coreutils + +COPY --from=base /usr/local/lib/python3.6/site-packages/snakeoil \ + /usr/local/lib/python3.6/site-packages/ + +RUN pip install git+https://github.com/dol-sen/pyDeComp + +COPY --from=base /usr/local/bin/shash /usr/local/bin/shash + +COPY --from=base /usr/local/lib/python3.6/site-packages/catalyst \ + /usr/local/lib/python3.6/site-packages/ + +COPY --from=base /usr/share/catalyst /usr/share + +COPY --from=base /etc/catalyst /etc/ # Override Stage3 preclean to add perl-cleaner invocation COPY stage3-preclean-chroot.sh \