Multistage build.

This commit is contained in:
Alexis Lahouze 2018-11-25 21:13:44 +01:00
parent 37d0ccd6bd
commit 134523d2da

View File

@ -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 \