From fbda23486f335e2a0e48dcf46bc2c2d0920cec5d Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Mon, 2 Nov 2020 14:28:33 -0800 Subject: [PATCH] Cut image size to 356 MB, down from 2 GB Using a Docker feature called "multi-stage builds" [1], we build Maiko in one image, then create a new one into which we copy the final binary but not sources and headers. Both images are still Ubuntu-based (todo), but the <400 MB final product is much slimmer than what we had before. [1]: https://docs.docker.com/develop/develop-images/multistage-build/ --- Dockerfile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3231275..ae8590bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,24 @@ FROM ubuntu:focal ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update -RUN apt-get install -y build-essential clang libx11-dev tightvncserver xfce4 xfce4-goodies -COPY . /build -WORKDIR /build/maiko/bin +RUN apt-get update && apt-get install -y build-essential clang libx11-dev +COPY maiko /build/ +WORKDIR /build/bin +RUN rm -rf /build/linux* RUN ./makeright x + + +FROM ubuntu:focal +ENV DEBIAN_FRONTEND=noninteractive + +EXPOSE 5900 + +RUN apt-get update && apt-get install -y tightvncserver RUN mkdir /app -RUN cp ../linux.x86_64/* /app -COPY loadups/xfull35.sysout /app +WORKDIR /app +COPY loadups ./ +COPY --from=0 /build/linux.x86_64/* ./ RUN adduser --disabled-password --gecos "" medley USER medley -WORKDIR /app ENTRYPOINT USER=medley Xvnc -geometry 1270x720 :0 & DISPLAY=:0 /app/ldex -g 1280x720 xfull35.sysout