1
0
mirror of synced 2026-01-13 15:37:38 +00:00

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/
This commit is contained in:
Abe Jellinek 2020-11-02 14:28:33 -08:00
parent c00fea902a
commit fbda23486f

View File

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