From 4900abb35dacb80188562bc576621113c1959a43 Mon Sep 17 00:00:00 2001 From: JalonSolov Date: Sun, 4 Feb 2024 15:32:23 -0500 Subject: [PATCH] Dockerfile: reduce to single layer in final image, cleanup (#4) --- Dockerfile | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index c134aad..457d085 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,21 +5,16 @@ RUN git clone --filter=blob:none https://github.com/vlang/v /vlang RUN cd /vlang; make; /vlang/v version RUN /vlang/v symlink -FROM buildv as buildapp -WORKDIR /app +WORKDIR /edu COPY . . -COPY --from=buildv /vlang/v /vlang/v -RUN /vlang/v symlink -RUN /vlang/v -v install -RUN /vlang/v -compress -cflags -static -cc gcc -prod -d trace_request_url -skip-unused -o edu-platform . +RUN mkdir /app +RUN v -v install +RUN v -compress -cflags -static -cc gcc -prod -d trace_request_url -skip-unused -o /app/edu-platform . +RUN mv ./assets /app && mv ./lessons /app && mv ./templates /app -FROM scratch as final +FROM scratch LABEL maintainer="Delyan Angelov " -WORKDIR /app -COPY ./lessons ./lessons -COPY ./templates ./templates -COPY ./assets ./assets -COPY --from=buildapp /app/edu-platform ./edu-platform +COPY --from=buildv /app /app EXPOSE 8082/tcp ENTRYPOINT ["/app/edu-platform"]