plex-test/Dockerfile

199 lines
6.1 KiB
Docker
Raw Normal View History

2018-10-31 22:08:04 +00:00
ARG PLEX_VER=1.13.9.5456-ecd600442
ARG PLEX_SHA=98e0c2dbd688910c78d0f39b5e5433ac67bbcd44
ARG LIBSTDCPP_VER=6.3.0-18+deb9u1
ARG LIBGCC1_VER=6.3.0-18+deb9u1
2018-08-09 09:59:39 +00:00
ARG XMLSTAR_VER=1.6.1
2018-10-03 16:10:13 +00:00
ARG CURL_VER=curl-7_61_1
2018-03-16 15:26:23 +00:00
2018-07-08 14:04:02 +00:00
FROM spritsail/debian-builder:stretch-slim as builder
ARG PLEX_VER
ARG PLEX_SHA
ARG LIBSTDCPP_VER
ARG LIBGCC1_VER
ARG LIBXML2_VER=v2.9.8
ARG LIBXSLT_VER=v1.1.32
2018-08-09 09:59:39 +00:00
ARG XMLSTAR_VER
2018-10-22 22:23:19 +00:00
ARG LIBRE_VER=2.8.2
2018-08-09 09:59:39 +00:00
ARG CURL_VER
RUN apt-get -y update \
&& apt-get -y install zlib1g-dev
2018-08-09 09:59:39 +00:00
# Download and build libxml2
WORKDIR /tmp/libxml2
RUN git clone https://gitlab.gnome.org/GNOME/libxml2.git --branch $LIBXML2_VER --depth 1 . \
&& ./autogen.sh \
--prefix=/usr \
--without-catalog \
--without-docbook \
--without-ftp \
--without-http \
--without-iconv \
--without-iso8859x \
--without-legacy \
--without-modules \
--without-python \
2018-10-04 11:51:27 +00:00
&& make -j$(nproc) \
&& make -j$(nproc) DESTDIR=/prefix install
# Download and build libxslt
WORKDIR /tmp/libxslt
RUN git clone https://gitlab.gnome.org/GNOME/libxslt.git --branch $LIBXSLT_VER --depth 1 . \
&& ./autogen.sh \
--prefix=/usr \
--with-libxml-src="../libxml2" \
--without-crypto \
--without-plugins \
--without-python \
2018-10-04 11:51:27 +00:00
&& make -j$(nproc) \
&& make -j$(nproc) DESTDIR=/prefix install
2018-08-09 09:59:39 +00:00
# Download and build xmlstarlet
2018-08-19 20:08:34 +00:00
ADD xmlstarlet-*.patch /tmp
2018-08-09 09:59:39 +00:00
WORKDIR /tmp/xmlstarlet
RUN git clone git://git.code.sf.net/p/xmlstar/code --branch $XMLSTAR_VER --depth 1 . \
&& git apply /tmp/xmlstarlet*.patch \
&& autoreconf -sif \
&& ./configure \
--prefix=/usr \
--disable-build-docs \
--with-libxml-prefix=/prefix/usr \
--with-libxslt-prefix=/prefix/usr \
2018-10-04 11:51:27 +00:00
&& make -j$(nproc) \
&& make -j$(nproc) DESTDIR=/prefix install
2018-08-09 09:59:39 +00:00
# Download and build LibreSSL as a cURL dependency
WORKDIR /tmp/libressl
RUN curl -sSL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRE_VER}.tar.gz \
| tar xz --strip-components=1 \
# Install to the default system directories so cURL can find it
&& ./configure --prefix=/usr \
2018-10-04 11:51:27 +00:00
&& make -j$(nproc) install
2018-08-09 09:59:39 +00:00
# Download and build curl
WORKDIR /tmp/curl
RUN git clone https://github.com/curl/curl.git --branch $CURL_VER --depth 1 . \
&& autoreconf -sif \
&& ./configure \
--prefix=/usr \
--enable-ipv6 \
--enable-optimize \
--enable-symbol-hiding \
--enable-versioned-symbols \
--enable-threaded-resolver \
--with-ssl \
--with-zlib \
--disable-crypto-auth \
--disable-curldebug \
--disable-dependency-tracking \
--disable-dict \
--disable-gopher \
--disable-imap \
2018-08-19 17:07:40 +00:00
--disable-libcurl-option \
2018-08-09 09:59:39 +00:00
--disable-ldap \
--disable-ldaps \
--disable-manual \
--disable-ntlm-wb \
--disable-pop3 \
--disable-rtsp \
--disable-smb \
--disable-smtp \
--disable-sspi \
--disable-telnet \
--disable-tftp \
--disable-tls-srp \
--disable-verbose \
--without-axtls \
--without-libmetalink \
--without-libpsl \
--without-librtmp \
--without-winidn \
2018-10-04 11:51:27 +00:00
&& make -j$(nproc) \
&& make -j$(nproc) DESTDIR=/prefix install
2018-08-09 09:59:39 +00:00
WORKDIR /prefix
# Fetch Plex and required libraries
RUN curl -fsSL http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBSTDCPP_VER:0:1}/libstdc++6_${LIBSTDCPP_VER}_amd64.deb | dpkg-deb -x - . \
&& curl -fsSL http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBGCC1_VER:0:1}/libgcc1_${LIBGCC1_VER}_amd64.deb | dpkg-deb -x - . \
&& curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server/${PLEX_VER}/plexmediaserver_${PLEX_VER}_amd64.deb \
\
2018-07-08 14:04:02 +00:00
&& echo "$PLEX_SHA plexmediaserver.deb" | sha1sum -c - \
&& dpkg-deb -x plexmediaserver.deb . \
2018-08-09 09:59:39 +00:00
\
&& cd usr/lib/plexmediaserver \
&& rm -f \
"Plex Media Server Tests" \
2018-08-20 19:40:47 +00:00
MigratePlexServerConfig.sh \
2018-08-09 09:59:39 +00:00
libcrypto.so.1.0.0 \
libcurl.so.4 \
libssl.so.1.0.0 \
libxml2.so.2 \
libxslt.so.1 \
2018-08-20 19:40:47 +00:00
Resources/start.sh \
2018-08-09 09:59:39 +00:00
# Place shared libraries in usr/lib so they can be actually shared
&& mv *.so* ../
# Strip all unneeded symbols for optimum size
RUN find -exec sh -c 'file "{}" | grep -q ELF && strip --strip-debug "{}"' \; \
\
&& mkdir -p /output/usr/lib /output/usr/bin \
&& mv usr/lib/x86_64-linux-gnu/*.so* \
lib/x86_64-linux-gnu/*.so* \
usr/lib/plexmediaserver \
usr/lib/*.so* \
/output/usr/lib \
&& mv usr/bin/curl /output/usr/bin \
&& mv usr/bin/xml /output/usr/bin/xmlstarlet
2018-07-08 14:04:02 +00:00
2018-08-19 19:27:47 +00:00
ADD entrypoint /output/usr/local/bin/
ADD *.sh /output/usr/local/bin/
RUN chmod +x /output/usr/local/bin/*
2018-07-08 14:04:02 +00:00
#=========================
FROM spritsail/libressl
ARG PLEX_VER
ARG LIBSTDCPP_VER
ARG LIBGCC1_VER
2018-08-09 09:59:39 +00:00
ARG CURL_VER
ARG XMLSTAR_VER
2018-07-08 14:04:02 +00:00
2018-03-16 15:26:23 +00:00
LABEL maintainer="Spritsail <plex@spritsail.io>" \
org.label-schema.vendor="Spritsail" \
org.label-schema.name="Plex Media Server" \
org.label-schema.url="https://www.plex.tv/downloads/" \
2018-07-08 13:30:52 +00:00
org.label-schema.description="Tiny Docker image for Plex Media Server, built on busybox" \
org.label-schema.version=${PLEX_VER} \
io.spritsail.version.plex=${PLEX_VER} \
2018-08-09 09:59:39 +00:00
io.spritsail.version.curl=${CURL_VER} \
io.spritsail.version.libgcc1=${LIBGCC1_VER} \
2018-07-08 13:30:52 +00:00
io.spritsail.version.libstdcpp=${LIBSTDCPP_VER} \
2018-08-09 09:59:39 +00:00
io.spritsail.version.xmlstarlet=${XMLSTAR_VER}
2016-08-26 21:26:39 +00:00
2018-08-19 19:27:47 +00:00
WORKDIR /usr/lib/plexmediaserver
2016-08-26 21:26:39 +00:00
2018-07-08 14:04:02 +00:00
COPY --from=builder /output/ /
2016-08-26 21:26:39 +00:00
2018-08-19 19:27:47 +00:00
ENV SUID=900 SGID=900 \
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6" \
PLEX_MEDIA_SERVER_MAX_STACK_SIZE="3000" \
PLEX_MEDIA_SERVER_TMPDIR="/tmp" \
PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver" \
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/var/lib/plexmediaserver"
2018-03-16 15:26:23 +00:00
HEALTHCHECK --interval=10s --timeout=5s \
CMD [ "wget", "-O", "/dev/null", "-T", "10", "-q", "localhost:32400/identity" ]
2017-09-19 23:50:12 +00:00
2018-07-08 14:04:02 +00:00
EXPOSE 32400
2018-08-19 19:27:47 +00:00
VOLUME ["/config", "/transcode"]
RUN mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" \
&& ln -sfv /config "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR/Plex Media Server"
ENTRYPOINT ["/sbin/tini", "--"]
2018-08-19 19:27:47 +00:00
CMD ["/usr/local/bin/entrypoint"]