2020-03-26 19:57:08 +00:00
|
|
|
ARG PLEX_VER=1.18.9.2571-e106a8a91
|
|
|
|
ARG PLEX_SHA=7bc22e03a74d992783645779b49f39443f7a3d4c
|
2018-08-09 09:59:39 +00:00
|
|
|
ARG XMLSTAR_VER=1.6.1
|
2019-11-27 22:24:19 +00:00
|
|
|
ARG CURL_VER=curl-7_66_0
|
2019-02-13 23:10:42 +00:00
|
|
|
ARG ZLIB_VER=1.2.11
|
2020-01-08 17:20:19 +00:00
|
|
|
ARG OPENSSL_VER=1.0.2u
|
2018-03-16 15:26:23 +00:00
|
|
|
|
2019-06-24 21:11:37 +00:00
|
|
|
FROM spritsail/debian-builder:buster-slim as builder
|
2018-07-08 14:04:02 +00:00
|
|
|
|
|
|
|
ARG PLEX_VER
|
|
|
|
ARG PLEX_SHA
|
2019-08-23 20:54:46 +00:00
|
|
|
ARG LIBXML2_VER=v2.9.9
|
|
|
|
ARG LIBXSLT_VER=v1.1.33
|
2018-08-09 09:59:39 +00:00
|
|
|
ARG XMLSTAR_VER
|
2020-01-08 17:20:19 +00:00
|
|
|
ARG OPENSSL_VER
|
2018-08-09 09:59:39 +00:00
|
|
|
ARG CURL_VER
|
2019-02-13 23:10:42 +00:00
|
|
|
ARG ZLIB_VER
|
2018-08-09 09:59:39 +00:00
|
|
|
|
2019-08-24 13:17:18 +00:00
|
|
|
ARG PREFIX=/prefix
|
|
|
|
|
|
|
|
WORKDIR /plex
|
2019-08-23 20:56:13 +00:00
|
|
|
|
|
|
|
# Fetch Plex and required libraries
|
|
|
|
RUN curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server-new/${PLEX_VER}/debian/plexmediaserver_${PLEX_VER}_amd64.deb \
|
|
|
|
&& echo "$PLEX_SHA plexmediaserver.deb" | sha1sum -c - \
|
|
|
|
&& dpkg-deb -x plexmediaserver.deb . \
|
|
|
|
\
|
2019-08-24 13:17:18 +00:00
|
|
|
&& rm -r \
|
2020-01-21 17:14:51 +00:00
|
|
|
etc/ usr/sbin/ usr/share/ \
|
2019-08-24 13:17:18 +00:00
|
|
|
plexmediaserver.deb \
|
|
|
|
\
|
2019-08-23 20:56:13 +00:00
|
|
|
&& cd usr/lib/plexmediaserver \
|
2019-08-24 13:17:18 +00:00
|
|
|
&& rm \
|
2019-08-23 20:56:13 +00:00
|
|
|
lib/libcrypto.so* \
|
|
|
|
lib/libcurl.so* \
|
|
|
|
lib/libssl.so* \
|
|
|
|
lib/libxml2.so* \
|
|
|
|
lib/libxslt.so* \
|
2019-08-24 13:17:18 +00:00
|
|
|
lib/libexslt.so* \
|
2020-01-21 17:14:51 +00:00
|
|
|
lib/plexmediaserver.* \
|
2019-08-23 20:56:13 +00:00
|
|
|
Resources/start.sh \
|
|
|
|
# Place shared libraries in usr/lib so they can be actually shared
|
2019-08-24 13:17:18 +00:00
|
|
|
&& mv lib/*.so* lib/dri ../ \
|
|
|
|
&& rmdir lib \
|
|
|
|
&& cp /lib/x86_64-linux-gnu/libgcc_s.so.1 ../
|
2019-08-23 20:56:13 +00:00
|
|
|
|
2019-02-13 23:10:42 +00:00
|
|
|
# Download and build zlib
|
|
|
|
WORKDIR /tmp/zlib
|
|
|
|
RUN curl -sSf https://www.zlib.net/zlib-$ZLIB_VER.tar.xz \
|
|
|
|
| tar xJ --strip-components=1 \
|
|
|
|
&& ./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--shared \
|
2019-08-24 13:17:18 +00:00
|
|
|
&& make DESTDIR=$PREFIX install
|
2018-08-09 09:59:39 +00:00
|
|
|
|
2018-08-19 15:22:31 +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 \
|
2019-08-24 13:17:18 +00:00
|
|
|
--with-zlib=$PREFIX/usr \
|
2018-08-19 19:24:29 +00:00
|
|
|
--without-catalog \
|
|
|
|
--without-docbook \
|
|
|
|
--without-ftp \
|
|
|
|
--without-http \
|
|
|
|
--without-iconv \
|
|
|
|
--without-iso8859x \
|
|
|
|
--without-legacy \
|
|
|
|
--without-modules \
|
2018-08-19 15:22:31 +00:00
|
|
|
--without-python \
|
2019-08-24 13:17:18 +00:00
|
|
|
&& make DESTDIR=$PREFIX install
|
2018-08-19 15:22:31 +00:00
|
|
|
|
|
|
|
# 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" \
|
2018-08-19 19:24:29 +00:00
|
|
|
--without-crypto \
|
|
|
|
--without-plugins \
|
2018-08-19 15:22:31 +00:00
|
|
|
--without-python \
|
2019-08-24 13:17:18 +00:00
|
|
|
&& make 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 \
|
2019-08-24 13:17:18 +00:00
|
|
|
--with-libxml-prefix=$PREFIX/usr \
|
|
|
|
--with-libxslt-prefix=$PREFIX/usr \
|
|
|
|
&& make DESTDIR=$PREFIX install
|
2018-08-09 09:59:39 +00:00
|
|
|
|
2020-01-08 17:20:19 +00:00
|
|
|
# Download and build OpenSSL as a cURL dependency
|
|
|
|
WORKDIR /tmp/openssl
|
|
|
|
RUN curl -sSL https://openssl.org/source/openssl-${OPENSSL_VER}.tar.gz \
|
2018-08-09 09:59:39 +00:00
|
|
|
| tar xz --strip-components=1 \
|
|
|
|
# Install to the default system directories so cURL can find it
|
2020-01-08 17:20:19 +00:00
|
|
|
&& ./config \
|
|
|
|
--prefix=/usr \
|
|
|
|
--libdir=lib \
|
|
|
|
--with-zlib-lib=$PREFIX/usr/lib/ \
|
|
|
|
--with-zlib-include=$PREFIX/usr/include \
|
|
|
|
shared \
|
|
|
|
zlib-dynamic \
|
|
|
|
no-rc5 \
|
|
|
|
&& make install \
|
|
|
|
&& cp libssl*.so* libcrypto*.so* $PREFIX/usr/lib
|
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 \
|
2019-08-24 13:17:18 +00:00
|
|
|
--with-zlib=$PREFIX/usr \
|
2018-08-09 09:59:39 +00:00
|
|
|
--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 \
|
2019-08-24 13:17:18 +00:00
|
|
|
&& make DESTDIR=$PREFIX install
|
|
|
|
|
|
|
|
WORKDIR $PREFIX
|
2018-08-09 09:59:39 +00:00
|
|
|
|
2019-08-24 13:17:18 +00:00
|
|
|
RUN mkdir -p /output/usr/lib /output/usr/bin \
|
|
|
|
&& mv usr/lib/*.so* \
|
|
|
|
/plex/usr/lib/* \
|
|
|
|
/output/usr/lib \
|
|
|
|
&& mv usr/bin/curl /output/usr/bin \
|
|
|
|
&& mv usr/bin/xml /output/usr/bin/xmlstarlet
|
2018-08-09 09:59:39 +00:00
|
|
|
|
|
|
|
# Strip all unneeded symbols for optimum size
|
2019-08-24 13:17:18 +00:00
|
|
|
RUN find /output -exec sh -c 'file "{}" | grep -q ELF && strip --strip-debug "{}"' \; \
|
2019-04-27 10:12:12 +00:00
|
|
|
# Disable executable stack in all libraries. This should already be the case
|
|
|
|
# but it seems libgnsdk is not playing along
|
2019-06-24 21:11:37 +00:00
|
|
|
&& apt-get -y update \
|
2019-04-27 10:12:12 +00:00
|
|
|
&& apt-get -y install execstack \
|
2019-08-24 13:17:18 +00:00
|
|
|
&& execstack -c /output/usr/lib/*.so*
|
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
|
|
|
|
|
|
|
#=========================
|
|
|
|
|
2020-01-08 17:20:19 +00:00
|
|
|
FROM spritsail/busybox:latest
|
2018-07-08 14:04:02 +00:00
|
|
|
|
|
|
|
ARG PLEX_VER
|
2018-08-09 09:59:39 +00:00
|
|
|
ARG CURL_VER
|
2020-01-08 17:20:19 +00:00
|
|
|
ARG OPENSSL_VER
|
2018-08-09 09:59:39 +00:00
|
|
|
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} \
|
2020-01-08 17:20:19 +00:00
|
|
|
io.spritsail.version.openssl=${OPENSSL_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"
|
|
|
|
|
2017-05-11 09:42:22 +00:00
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
2018-08-19 19:27:47 +00:00
|
|
|
CMD ["/usr/local/bin/entrypoint"]
|