From 617d69a94f04d8178f97ec291acb8780a05ebd9b Mon Sep 17 00:00:00 2001 From: Naman Sood Date: Fri, 29 Mar 2024 17:30:11 -0400 Subject: [PATCH] reduce docker image size Signed-off-by: Naman Sood --- Dockerfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8216ca7..8eb8b27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,27 @@ -FROM golang:bookworm +FROM golang:bookworm as builder WORKDIR / ENV SASS_VERSION=1.72.0 ENV SASS_TARFILE="dart-sass-${SASS_VERSION}-linux-x64.tar.gz" ADD "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/$SASS_TARFILE" . -RUN tar -xf $SASS_TARFILE -RUN mv dart-sass/* bin/ +RUN mv $SASS_TARFILE sass.tgz WORKDIR /prose COPY --link go.mod go.sum ./ COPY --link cmd/prose cmd/prose RUN go build ./cmd/prose +FROM bitnami/minideb:bookworm + WORKDIR /bin -RUN cp /prose/prose . +COPY --link --from=builder /sass.tgz / +RUN tar xf /sass.tgz +RUN mv dart-sass/* . +COPY --link --from=builder /prose/prose . WORKDIR /srv COPY --link posts posts COPY --link static static COPY --link styles styles COPY --link templates templates -ENV PATH=/bin ENTRYPOINT ["prose"]