Update image with adamant/busybox base image.
No more patchelf and patching binaries on restart!
This commit is contained in:
parent
ef473600dc
commit
996fb2a7ac
38
Dockerfile
38
Dockerfile
@ -1,38 +1,20 @@
|
|||||||
FROM adamant/alpine-glibc
|
FROM adamant/busybox
|
||||||
MAINTAINER Adam Dodman <adam.dodman@gmx.com>
|
MAINTAINER Adam Dodman <adam.dodman@gmx.com>
|
||||||
|
|
||||||
ENV UID=787 UNAME=plex GID=990 GNAME=media
|
ENV UID=787 GID=990
|
||||||
ADD start_pms.patch /tmp/start_pms.patch
|
ADD start_pms.patch /tmp/start_pms.patch
|
||||||
|
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
RUN addgroup -g $GID $GNAME \
|
RUN wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.9/libstdc++6_4.9.2-10_amd64.deb \
|
||||||
&& adduser -SH -u $UID -G $GNAME -s /usr/sbin/nologin $UNAME \
|
&& pkgextract libstdc++6*.deb \
|
||||||
|
|
||||||
&& apk add --no-cache xz binutils patchelf openssl file \
|
|
||||||
|
|
||||||
&& wget -O plexmediaserver.deb 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' \
|
&& wget -O plexmediaserver.deb 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' \
|
||||||
|
&& dpkg-deb -x plexmediaserver.deb / \
|
||||||
&& ar x plexmediaserver.deb \
|
&& cd /usr/sbin/ \
|
||||||
&& tar -xf data.tar.* \
|
&& patch < /tmp/start_pms.patch \
|
||||||
|
|
||||||
&& find usr/lib/plexmediaserver -type f -perm /0111 -exec sh -c "file --brief \"{}\" | grep -q "ELF" && patchelf --set-interpreter \"$GLIBC_LD_LINUX_SO\" \"{}\" " \; \
|
|
||||||
|
|
||||||
&& mv /tmp/start_pms.patch usr/sbin/ \
|
|
||||||
&& cd usr/sbin/ \
|
|
||||||
&& patch < start_pms.patch \
|
|
||||||
&& cd /tmp \
|
|
||||||
&& sed -i "s|<destdir>|$DESTDIR|" usr/sbin/start_pms \
|
|
||||||
|
|
||||||
&& mv usr/sbin/start_pms $DESTDIR/ \
|
|
||||||
&& mv usr/lib/plexmediaserver $DESTDIR/plex-media-server \
|
|
||||||
|
|
||||||
&& apk del --no-cache xz binutils patchelf file \
|
|
||||||
&& rm -rf /tmp/*
|
&& rm -rf /tmp/*
|
||||||
|
|
||||||
|
WORKDIR /usr/lib/plexmediaserver
|
||||||
|
|
||||||
USER plex
|
ENTRYPOINT ["/sbin/tini", "--"]
|
||||||
|
CMD ["su-exec", "$UID:$GID", "start_pms"]
|
||||||
WORKDIR /glibc
|
|
||||||
|
|
||||||
CMD ["/glibc/start_pms"]
|
|
||||||
|
@ -17,33 +17,35 @@
|
|||||||
-test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver
|
-test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver
|
||||||
+# Default values
|
+# Default values
|
||||||
+export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="${PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS:-6}"
|
+export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="${PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS:-6}"
|
||||||
+export PLEX_MEDIA_SERVER_HOME="${PLEX_MEDIA_SERVER_HOME:-<destdir>/plex-media-server}"
|
+export PLEX_MEDIA_SERVER_HOME="${PLEX_MEDIA_SERVER_HOME:-/usr/lib/plexmediaserver}"
|
||||||
+export PLEX_MEDIA_SERVER_MAX_STACK_SIZE="${PLEX_MEDIA_SERVER_MAX_STACK_SIZE:-3000}"
|
+export PLEX_MEDIA_SERVER_MAX_STACK_SIZE="${PLEX_MEDIA_SERVER_MAX_STACK_SIZE:-3000}"
|
||||||
+export PLEX_MEDIA_SERVER_TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR:-/tmp}"
|
+export PLEX_MEDIA_SERVER_TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR:-/tmp}"
|
||||||
+export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config}"
|
+export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config}"
|
||||||
|
|
||||||
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
|
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
|
||||||
then
|
then
|
||||||
@@ -23,14 +17,17 @@
|
@@ -22,15 +16,17 @@
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
+if [ ! -w "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
|
||||||
|
+then
|
||||||
|
+ echo "ERROR: CANNOT WRITE IN $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSION TO DO THAT!"
|
||||||
|
+ exit 2
|
||||||
|
+fi
|
||||||
|
|
||||||
-export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
|
-export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
|
||||||
+export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}:${GLIBC_LIBRARY_PATH}"
|
+export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}:$LD_LIBRARY_PATH"
|
||||||
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
|
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
|
||||||
|
|
||||||
-echo $PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS $PLEX_MEDIA_SERVER_MAX_STACK_SIZE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR
|
-echo $PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS $PLEX_MEDIA_SERVER_MAX_STACK_SIZE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR
|
||||||
+# Fix Locale, busybox doesn't care about it
|
-
|
||||||
+export LANG=C
|
|
||||||
+export LC_ALL=C
|
|
||||||
|
|
||||||
-ulimit -s $PLEX_MAX_STACK_SIZE
|
-ulimit -s $PLEX_MAX_STACK_SIZE
|
||||||
+cd "$PLEX_MEDIA_SERVER_HOME"
|
-
|
||||||
|
|
||||||
-# Add sleep - Possible fix for start on boot.
|
-# Add sleep - Possible fix for start on boot.
|
||||||
-sleep 3
|
-sleep 3
|
||||||
+if [ -f /config/plex/Plex\ Media\ Server/plexmediaserver.pid ]; then
|
+if [ -f /config/Plex\ Media\ Server/plexmediaserver.pid ]; then
|
||||||
+ rm -f /config/plex/Plex\ Media\ Server/plexmediaserver.pid
|
+ rm -f /config/Plex\ Media\ Server/plexmediaserver.pid
|
||||||
+fi
|
+fi
|
||||||
|
|
||||||
-(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
|
-(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
|
||||||
|
Loading…
Reference in New Issue
Block a user