From f8b76a72badd6434a12131d159ee67d6b8d449dd Mon Sep 17 00:00:00 2001 From: Adam Dodman Date: Thu, 8 Sep 2016 23:59:52 +0100 Subject: [PATCH] Split glibc into seperate base image --- Dockerfile | 42 ++++++++++++------------------------------ 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6b4aa39..c83ed03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,7 @@ -FROM alpine:3.4 +FROM adamant/alpine-glibc MAINTAINER Adam Dodman -ENV UID=787 UNAME=plex GID=990 GNAME=media DESTDIR="/plex" -ENV GLIBC_LIBRARY_PATH="$DESTDIR/lib" DEBS="libc6 libgcc1 libstdc++6 plexmediaserver" -ENV GLIBC_LD_LINUX_SO="$GLIBC_LIBRARY_PATH/ld-linux-x86-64.so.2" - +ENV UID=787 UNAME=plex GID=990 GNAME=media ADD start_pms.patch /tmp/start_pms.patch WORKDIR /tmp @@ -12,38 +9,23 @@ WORKDIR /tmp RUN addgroup -g $GID $GNAME \ && adduser -SH -u $UID -G $GNAME -s /usr/sbin/nologin $UNAME \ - && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ && apk add --no-cache xz binutils patchelf openssl file \ - && wget http://ftp.debian.org/debian/pool/main/g/glibc/libc6_2.23-5_amd64.deb \ - && wget http://ftp.debian.org/debian/pool/main/g/gcc-4.9/libgcc1_4.9.2-10_amd64.deb \ - && 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 \ - mkdir $pkg; \ - cd $pkg; \ - ar x ../$pkg*.deb; \ - tar -xf data.tar.*; \ - cd ..; \ - done \ + && ar x plexmediaserver.deb \ + && tar -xf data.tar.* \ - && mkdir -p $GLIBC_LIBRARY_PATH \ + && find usr/lib/plexmediaserver -type f -perm /0111 -exec sh -c "file --brief \"{}\" | grep -q "ELF" && patchelf --set-interpreter \"$GLIBC_LD_LINUX_SO\" \"{}\" " \; \ - && 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\" \"{}\" " \; \ - - && mv /tmp/start_pms.patch plexmediaserver/usr/sbin/ \ - && cd plexmediaserver/usr/sbin/ \ + && mv /tmp/start_pms.patch usr/sbin/ \ + && cd usr/sbin/ \ && patch < start_pms.patch \ && cd /tmp \ - && sed -i "s||$DESTDIR|" plexmediaserver/usr/sbin/start_pms \ + && sed -i "s||$DESTDIR|" usr/sbin/start_pms \ - && mv plexmediaserver/usr/sbin/start_pms $DESTDIR/ \ - && mv plexmediaserver/usr/lib/plexmediaserver $DESTDIR/plex-media-server \ + && 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/* @@ -51,6 +33,6 @@ RUN addgroup -g $GID $GNAME \ USER plex -WORKDIR /plex +WORKDIR /glibc -CMD ["/plex/start_pms"] +CMD ["/glibc/start_pms"]