From 8a4ed82279f42c504fe8b5519218dfe01d5cf5e5 Mon Sep 17 00:00:00 2001 From: Adam Dodman Date: Sun, 8 Jul 2018 15:04:02 +0100 Subject: [PATCH] Move to mutli-stage build --- Dockerfile | 61 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8363202..48c02e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,45 @@ -FROM spritsail/libressl - ARG PLEX_VER=1.13.2.5154-fd05be322 ARG PLEX_SHA=81ff7f8d80ac46ca663a54e09667ad47a2ccb1cd ARG LIBSTDCPP_VER=6.3.0-18+deb9u1 ARG LIBGCC1_VER=6.3.0-18+deb9u1 +FROM spritsail/debian-builder:stretch-slim as builder + +ARG PLEX_VER +ARG PLEX_SHA +ARG LIBSTDCPP_VER +ARG LIBGCC1_VER + +WORKDIR /tmp + +RUN mkdir -p /output/usr/lib /output/{lib, sbin} + +RUN curl -fsSL -o libstdcpp.deb http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBSTDCPP_VER:0:1}/libstdc++6_${LIBSTDCPP_VER}_amd64.deb \ + && curl -fsSL -o libgcc1.deb http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBGCC1_VER:0:1}/libgcc1_${LIBGCC1_VER}_amd64.deb \ + && dpkg-deb -x libstdcpp.deb . \ + && dpkg-deb -x libgcc1.deb . \ + # We only need the lib files, everything else is debian junk. + && mv $PWD/usr/lib/x86_64-linux-gnu/* /output/usr/lib \ + # Maybe /lib + && mv $PWD/lib/x86_64-linux-gnu/* /output/usr/lib + +RUN curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server/${PLEX_VER}/plexmediaserver_${PLEX_VER}_amd64.deb \ + && echo "$PLEX_SHA plexmediaserver.deb" | sha1sum -c - \ + && dpkg-deb -x plexmediaserver.deb . \ + && mv usr/lib/plexmediaserver /output/usr/lib + + +ADD start_pms /output/usr/sbin/start_pms +RUN chmod +x /output/usr/sbin/start_pms + +#========================= + +FROM spritsail/libressl + +ARG PLEX_VER +ARG LIBSTDCPP_VER +ARG LIBGCC1_VER + LABEL maintainer="Spritsail " \ org.label-schema.vendor="Spritsail" \ org.label-schema.name="Plex Media Server" \ @@ -16,29 +51,15 @@ LABEL maintainer="Spritsail " \ io.spritsail.version.libgcc1=${LIBGCC1_VER} ENV SUID=900 SGID=900 -ADD start_pms /usr/sbin/start_pms -WORKDIR /tmp - -RUN chmod +x /usr/sbin/start_pms \ - && wget http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBSTDCPP_VER:0:1}/libstdc++6_${LIBSTDCPP_VER}_amd64.deb \ - && wget http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBGCC1_VER:0:1}/libgcc1_${LIBGCC1_VER}_amd64.deb \ - && dpkg-deb -x libstdc++6*.deb . \ - && dpkg-deb -x libgcc1*.deb . \ - # We only need the lib files, everything else is debian junk. - && mv $PWD/usr/lib/x86_64-linux-gnu/* /lib \ - && mv $PWD/lib/x86_64-linux-gnu/* /lib \ - && echo "$PLEX_SHA plexmediaserver.deb" > sumfile \ - && wget -O plexmediaserver.deb https://downloads.plex.tv/plex-media-server/${PLEX_VER}/plexmediaserver_${PLEX_VER}_amd64.deb \ - && sha1sum -c sumfile \ - && dpkg-deb -x plexmediaserver.deb . \ - && mv usr/lib/plexmediaserver /usr/lib \ - && find $PWD -mindepth 1 -delete +COPY --from=builder /output/ / HEALTHCHECK --interval=10s --timeout=5s \ CMD [ "wget", "-O", "/dev/null", "-T", "10", "-q", "localhost:32400/identity" ] WORKDIR /usr/lib/plexmediaserver +EXPOSE 32400 + ENTRYPOINT ["/sbin/tini", "--"] -CMD ["start_pms"] +CMD ["/usr/sbin/start_pms"]