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>
|
||||
|
||||
ENV UID=787 UNAME=plex GID=990 GNAME=media
|
||||
ENV UID=787 GID=990
|
||||
ADD start_pms.patch /tmp/start_pms.patch
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
RUN addgroup -g $GID $GNAME \
|
||||
&& adduser -SH -u $UID -G $GNAME -s /usr/sbin/nologin $UNAME \
|
||||
|
||||
&& apk add --no-cache xz binutils patchelf openssl file \
|
||||
|
||||
RUN wget http://ftp.de.debian.org/debian/pool/main/g/gcc-4.9/libstdc++6_4.9.2-10_amd64.deb \
|
||||
&& pkgextract libstdc++6*.deb \
|
||||
&& wget -O plexmediaserver.deb 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' \
|
||||
|
||||
&& ar x plexmediaserver.deb \
|
||||
&& tar -xf data.tar.* \
|
||||
|
||||
&& 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 \
|
||||
&& dpkg-deb -x plexmediaserver.deb / \
|
||||
&& cd /usr/sbin/ \
|
||||
&& patch < /tmp/start_pms.patch \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
WORKDIR /usr/lib/plexmediaserver
|
||||
|
||||
USER plex
|
||||
|
||||
WORKDIR /glibc
|
||||
|
||||
CMD ["/glibc/start_pms"]
|
||||
ENTRYPOINT ["/sbin/tini", "--"]
|
||||
CMD ["su-exec", "$UID:$GID", "start_pms"]
|
||||
|
@ -17,33 +17,35 @@
|
||||
-test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver
|
||||
+# Default values
|
||||
+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_TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR:-/tmp}"
|
||||
+export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR:-/config}"
|
||||
|
||||
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
|
||||
then
|
||||
@@ -23,14 +17,17 @@
|
||||
@@ -22,15 +16,17 @@
|
||||
exit 1
|
||||
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}:${GLIBC_LIBRARY_PATH}"
|
||||
+export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}:$LD_LIBRARY_PATH"
|
||||
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
|
||||
+# Fix Locale, busybox doesn't care about it
|
||||
+export LANG=C
|
||||
+export LC_ALL=C
|
||||
|
||||
-
|
||||
-ulimit -s $PLEX_MAX_STACK_SIZE
|
||||
+cd "$PLEX_MEDIA_SERVER_HOME"
|
||||
|
||||
-
|
||||
-# Add sleep - Possible fix for start on boot.
|
||||
-sleep 3
|
||||
+if [ -f /config/plex/Plex\ Media\ Server/plexmediaserver.pid ]; then
|
||||
+ rm -f /config/plex/Plex\ Media\ Server/plexmediaserver.pid
|
||||
+if [ -f /config/Plex\ Media\ Server/plexmediaserver.pid ]; then
|
||||
+ rm -f /config/Plex\ Media\ Server/plexmediaserver.pid
|
||||
+fi
|
||||
|
||||
-(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
|
||||
|
Loading…
Reference in New Issue
Block a user