From e6cf367e231ca8eab977b61a1f5aca1058ceca2b Mon Sep 17 00:00:00 2001 From: Oliver Hanikel Date: Sun, 11 Jul 2021 20:00:39 +0200 Subject: [PATCH] reduce size of docker image --- Dockerfile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index e8732b3..98d5a8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,22 @@ -FROM rust - -WORKDIR /usr/local/src/ -RUN curl -s https://api.github.com/repos/y2z/monolith/releases/latest \ - | grep "tarball_url.*\"," \ - | cut -d '"' -f 4 \ - | wget -qi - -O monolith.tar.gz +FROM ekidd/rust-musl-builder as builder +RUN curl -L -o monolith.tar.gz $(curl -s https://api.github.com/repos/y2z/monolith/releases/latest \ + | grep "tarball_url.*\"," \ + | cut -d '"' -f 4) RUN tar xfz monolith.tar.gz \ && mv Y2Z-monolith-* monolith \ && rm monolith.tar.gz -WORKDIR /usr/local/src/monolith -RUN ls -a +WORKDIR monolith/ RUN make install + +FROM alpine + +RUN apk update && \ + apk add --no-cache openssl && \ + rm -rf "/var/cache/apk/*" + +COPY --from=builder /home/rust/.cargo/bin/monolith /usr/bin/monolith WORKDIR /tmp -CMD ["/usr/local/cargo/bin/monolith"] +ENTRYPOINT ["/usr/bin/monolith"]