From aa4cc38b807e4be3036610979b08f1e5ad226b8a Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Fri, 26 Aug 2016 23:03:01 +0100 Subject: [PATCH 1/2] Cleaner use of environment variables. Removed the need for vars.sh --- Dockerfile | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2f5f88a..db70e19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,8 @@ FROM alpine:3.4 MAINTAINER Adam Dodman -ENV UID=787 UNAME=plex GID=990 GNAME=media -ENV debs "libc6 libgcc1 libstdc++6 plexmediaserver" -ENV destdir "/plex" +ENV UID=787 UNAME=plex GID=990 GNAME=media DESTDIR="/plex" +ENV GLIBC_LIBRARY_PATH="/plex/lib" GLIBC_LD_LINUX_SO="/plex/lib/ld-linux-x86-64.so.2" ADD start_pms.patch /tmp/start_pms.patch @@ -20,7 +19,7 @@ RUN addgroup -g $GID $GNAME \ && wget http://ftp.debian.org/debian/pool/main/g/gcc-4.9/libstdc++6_4.9.2-10_amd64.deb \ && wget -O plexmediaserver.deb 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' \ - && for pkg in $debs; do \ + && for pkg in libc6 libgcc1 libstdc++6 plexmediaserver; do \ mkdir $pkg; \ cd $pkg; \ ar x ../$pkg*.deb; \ @@ -28,17 +27,11 @@ RUN addgroup -g $GID $GNAME \ cd ..; \ done \ - && mkdir -p $destdir/lib \ + && mkdir -p $GLIBC_LIBRARY_PATH \ - && mv libc6/lib/x86_64-linux-gnu/* $destdir/lib \ - && mv libgcc1/lib/x86_64-linux-gnu/* $destdir/lib \ - && mv libstdc++6/usr/lib/x86_64-linux-gnu/* $destdir/lib \ - - && echo "export GLIBC_LIBRARY_PATH=/plex/lib" >"$destdir/lib/vars.sh" \ - && echo "export GLIBC_LD_LINUX_SO=/plex/lib/ld-linux-x86-64.so.2" >>"$destdir/lib/vars.sh" \ - && chmod +x $destdir/lib/vars.sh \ - - && . $destdir/lib/vars.sh \ + && mv libc6/lib/x86_64-linux-gnu/* $GLIBC_LIBRARY_PATH \ + && mv libgcc1/lib/x86_64-linux-gnu/* $GLIBC_LIBRARY_PATH \ + && mv libstdc++6/usr/lib/x86_64-linux-gnu/* $GLIBC_LIBRARY_PATH \ && find plexmediaserver/usr/lib/plexmediaserver -type f -perm /0111 -exec sh -c "file --brief \"{}\" | grep -q "ELF" && patchelf --set-interpreter \"$GLIBC_LD_LINUX_SO\" \"{}\" " \; \ @@ -46,10 +39,10 @@ RUN addgroup -g $GID $GNAME \ && cd plexmediaserver/usr/sbin/ \ && patch < start_pms.patch \ && cd /tmp \ - && sed -i "s||$destdir|" plexmediaserver/usr/sbin/start_pms \ + && sed -i "s||$DESTDIR|" plexmediaserver/usr/sbin/start_pms \ - && mv plexmediaserver/usr/sbin/start_pms $destdir/ \ - && mv plexmediaserver/usr/lib/plexmediaserver $destdir/plex-media-server \ + && mv plexmediaserver/usr/sbin/start_pms $DESTDIR/ \ + && mv plexmediaserver/usr/lib/plexmediaserver $DESTDIR/plex-media-server \ && apk del --no-cache xz binutils patchelf file \ && rm -rf /tmp/* From de30f6a0a905956c7445fdeebd587cfaeeff4bcc Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Sat, 27 Aug 2016 00:07:25 +0100 Subject: [PATCH 2/2] Improve environment portability some more --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index db70e19..d82ca22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,8 @@ FROM alpine:3.4 MAINTAINER Adam Dodman ENV UID=787 UNAME=plex GID=990 GNAME=media DESTDIR="/plex" -ENV GLIBC_LIBRARY_PATH="/plex/lib" GLIBC_LD_LINUX_SO="/plex/lib/ld-linux-x86-64.so.2" +ENV GLIBC_LIBRARY_PATH="$DESTDIR/lib" GLIBC_LD_LINUX_SO="/plex/lib/ld-linux-x86-64.so.2" +ENV DEBS="libc6 libgcc1 libstdc++6 plexmediaserver" ADD start_pms.patch /tmp/start_pms.patch @@ -19,7 +20,7 @@ RUN addgroup -g $GID $GNAME \ && wget http://ftp.debian.org/debian/pool/main/g/gcc-4.9/libstdc++6_4.9.2-10_amd64.deb \ && wget -O plexmediaserver.deb 'https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu' \ - && for pkg in libc6 libgcc1 libstdc++6 plexmediaserver; do \ + && for pkg in $DEBS; do \ mkdir $pkg; \ cd $pkg; \ ar x ../$pkg*.deb; \