Bring up to date, add curl

This commit is contained in:
Joe Groocock 2018-08-09 10:59:39 +01:00
parent 6fb006928d
commit b8b629552e
Signed by: frebib
GPG Key ID: E0B16BEACFBB6A86
4 changed files with 151 additions and 27 deletions

View File

@ -4,6 +4,13 @@ pipeline:
volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ] volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ]
repo: plex-dev repo: plex-dev
test-bin:
image: docker
volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ]
commands:
- docker run --rm plex-dev curl --version
- docker run --rm plex-dev xmlstarlet --version
test: test:
image: spritsail/docker-test image: spritsail/docker-test
volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ] volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ]
@ -19,12 +26,11 @@ pipeline:
image: spritsail/docker-publish image: spritsail/docker-publish
volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ] volumes: [ '/var/run/docker.sock:/var/run/docker.sock' ]
secrets: [ docker_username, docker_password, microbadger_token ] secrets: [ docker_username, docker_password, microbadger_token ]
when: { branch: [ master, pass ], event: [ push, tag, deployment ] } when: { branch: [ init-scripts ], event: [ push, tag, deployment ] }
from: plex-dev from: plex-dev
repo: spritsail/plex-media-server repo: spritsail/plex-media-server
tags: tags:
- 'latest' - 'init-scripts'
- '%labelauto: io.spritsail.version.plex'
notify: notify:
image: spritsail/notify image: spritsail/notify

View File

@ -2,6 +2,8 @@ ARG PLEX_VER=1.13.5.5291-6fa5e50a8
ARG PLEX_SHA=0cb4cb011583edb0b26898d2e62253c55fc88bc7 ARG PLEX_SHA=0cb4cb011583edb0b26898d2e62253c55fc88bc7
ARG LIBSTDCPP_VER=6.3.0-18+deb9u1 ARG LIBSTDCPP_VER=6.3.0-18+deb9u1
ARG LIBGCC1_VER=6.3.0-18+deb9u1 ARG LIBGCC1_VER=6.3.0-18+deb9u1
ARG XMLSTAR_VER=1.6.1
ARG CURL_VER=curl-7_61_0
FROM spritsail/debian-builder:stretch-slim as builder FROM spritsail/debian-builder:stretch-slim as builder
@ -9,25 +11,106 @@ ARG PLEX_VER
ARG PLEX_SHA ARG PLEX_SHA
ARG LIBSTDCPP_VER ARG LIBSTDCPP_VER
ARG LIBGCC1_VER ARG LIBGCC1_VER
ARG XMLSTAR_VER
ARG LIBRE_VER=2.7.4
ARG CURL_VER
WORKDIR /tmp ARG MAKEFLAGS=-j4
RUN mkdir -p /output/usr/lib RUN apt-get -y update \
&& apt-get -y install libxml2-dev libxslt1-dev zlib1g-dev
RUN curl -fsSL -o libstdcpp.deb http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBSTDCPP_VER:0:1}/libstdc++6_${LIBSTDCPP_VER}_amd64.deb \ ADD *.patch /tmp
&& curl -fsSL -o libgcc1.deb http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBGCC1_VER:0:1}/libgcc1_${LIBGCC1_VER}_amd64.deb \
&& dpkg-deb -x libstdcpp.deb . \
&& dpkg-deb -x libgcc1.deb . \
# We only need the lib files, everything else is debian junk.
&& mv $PWD/usr/lib/x86_64-linux-gnu/* /output/usr/lib \
# Maybe /lib
&& mv $PWD/lib/x86_64-linux-gnu/* /output/usr/lib
RUN curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server/${PLEX_VER}/plexmediaserver_${PLEX_VER}_amd64.deb \ # Download and build xmlstarlet
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 \
&& make \
&& make DESTDIR=/prefix install
# Download and build LibreSSL as a cURL dependency
WORKDIR /tmp/libressl
RUN curl -sSL https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-${LIBRE_VER}.tar.gz \
| tar xz --strip-components=1 \
# Install to the default system directories so cURL can find it
&& ./configure --prefix=/usr \
&& make install
# 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 \
--with-zlib \
--disable-crypto-auth \
--disable-curldebug \
--disable-dependency-tracking \
--disable-dict \
--disable-gopher \
--disable-imap \
--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 \
&& make \
&& make DESTDIR=/prefix install
WORKDIR /prefix
# Fetch Plex and required libraries
RUN curl -fsSL http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBSTDCPP_VER:0:1}/libstdc++6_${LIBSTDCPP_VER}_amd64.deb | dpkg-deb -x - . \
&& curl -fsSL http://ftp.de.debian.org/debian/pool/main/g/gcc-${LIBGCC1_VER:0:1}/libgcc1_${LIBGCC1_VER}_amd64.deb | dpkg-deb -x - . \
&& curl -fsSL -o plexmediaserver.deb https://downloads.plex.tv/plex-media-server/${PLEX_VER}/plexmediaserver_${PLEX_VER}_amd64.deb \
\
&& echo "$PLEX_SHA plexmediaserver.deb" | sha1sum -c - \ && echo "$PLEX_SHA plexmediaserver.deb" | sha1sum -c - \
&& dpkg-deb -x plexmediaserver.deb . \ && dpkg-deb -x plexmediaserver.deb . \
&& mv usr/lib/plexmediaserver /output/usr/lib \
&& cd usr/lib/plexmediaserver \
&& rm -f \
"Plex Media Server Tests" \
libcrypto.so.1.0.0 \
libcurl.so.4 \
libssl.so.1.0.0 \
# Place shared libraries in usr/lib so they can be actually shared
&& mv *.so* ../
# Strip all unneeded symbols for optimum size
RUN find -exec sh -c 'file "{}" | grep -q ELF && strip --strip-debug "{}"' \; \
\
&& mkdir -p /output/usr/lib /output/usr/bin \
&& mv usr/lib/x86_64-linux-gnu/*.so* \
lib/x86_64-linux-gnu/*.so* \
usr/lib/plexmediaserver \
usr/lib/*.so* \
/output/usr/lib \
&& mv usr/bin/curl /output/usr/bin \
&& mv usr/bin/xml /output/usr/bin/xmlstarlet
ADD start_pms /output/usr/sbin/start_pms ADD start_pms /output/usr/sbin/start_pms
RUN chmod +x /output/usr/sbin/start_pms RUN chmod +x /output/usr/sbin/start_pms
@ -39,6 +122,8 @@ FROM spritsail/libressl
ARG PLEX_VER ARG PLEX_VER
ARG LIBSTDCPP_VER ARG LIBSTDCPP_VER
ARG LIBGCC1_VER ARG LIBGCC1_VER
ARG CURL_VER
ARG XMLSTAR_VER
LABEL maintainer="Spritsail <plex@spritsail.io>" \ LABEL maintainer="Spritsail <plex@spritsail.io>" \
org.label-schema.vendor="Spritsail" \ org.label-schema.vendor="Spritsail" \
@ -47,8 +132,10 @@ LABEL maintainer="Spritsail <plex@spritsail.io>" \
org.label-schema.description="Tiny Docker image for Plex Media Server, built on busybox" \ org.label-schema.description="Tiny Docker image for Plex Media Server, built on busybox" \
org.label-schema.version=${PLEX_VER} \ org.label-schema.version=${PLEX_VER} \
io.spritsail.version.plex=${PLEX_VER} \ io.spritsail.version.plex=${PLEX_VER} \
io.spritsail.version.curl=${CURL_VER} \
io.spritsail.version.libgcc1=${LIBGCC1_VER} \
io.spritsail.version.libstdcpp=${LIBSTDCPP_VER} \ io.spritsail.version.libstdcpp=${LIBSTDCPP_VER} \
io.spritsail.version.libgcc1=${LIBGCC1_VER} io.spritsail.version.xmlstarlet=${XMLSTAR_VER}
ENV SUID=900 SGID=900 ENV SUID=900 SGID=900

18
start_pms Normal file → Executable file
View File

@ -7,32 +7,28 @@ export PLEX_MEDIA_SERVER_MAX_STACK_SIZE="${PLEX_MEDIA_SERVER_MAX_STACK_SIZE:-300
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}"
export PLEX_MEDIA_SERVER_CONFIG_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server" export PLEX_MEDIA_SERVER_CONFIG_DIR="${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server"
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
if [ ! -d "$PLEX_MEDIA_SERVER_CONFIG_DIR" ] if [ ! -d "$PLEX_MEDIA_SERVER_CONFIG_DIR" ]; then
then
mkdir -p "$PLEX_MEDIA_SERVER_CONFIG_DIR" && \ mkdir -p "$PLEX_MEDIA_SERVER_CONFIG_DIR" && \
chown $SUID:$SGID "$PLEX_MEDIA_SERVER_CONFIG_DIR" chown $SUID:$SGID "$PLEX_MEDIA_SERVER_CONFIG_DIR"
if [ ! $? -eq 0 ] if [ ! $? -eq 0 ]; then
then
echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_CONFIG_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!" echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_CONFIG_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!"
exit 1 exit 1
fi fi
fi fi
if su-exec -e [ ! -w "$PLEX_MEDIA_SERVER_CONFIG_DIR" ]
then if su-exec -e [ ! -w "$PLEX_MEDIA_SERVER_CONFIG_DIR" ]; then
echo "ERROR: CANNOT WRITE IN $PLEX_MEDIA_SERVER_CONFIG_DIR, MAKE SURE I HAVE PERMISSION TO DO THAT!" echo "ERROR: CANNOT WRITE IN $PLEX_MEDIA_SERVER_CONFIG_DIR, MAKE SURE I HAVE PERMISSION TO DO THAT!"
exit 2 exit 2
fi fi
if [ ! -e "$PLEX_MEDIA_SERVER_CONFIG_DIR/Preferences.xml" ];
then if [ ! -e "$PLEX_MEDIA_SERVER_CONFIG_DIR/Preferences.xml" ]; then
# Create a default config file allowing external access # Create a default config file allowing external access
echo -e '<?xml version="1.0" encoding="utf-8"?>\n<Preferences disableRemoteSecurity="1" />' \ echo -e '<?xml version="1.0" encoding="utf-8"?>\n<Preferences disableRemoteSecurity="1" />' \
>> "$PLEX_MEDIA_SERVER_CONFIG_DIR/Preferences.xml" >> "$PLEX_MEDIA_SERVER_CONFIG_DIR/Preferences.xml"
fi fi
export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}:$LD_LIBRARY_PATH"
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
# Allow Plex group to write to tmpdir # Allow Plex group to write to tmpdir
chgrp $SGID "$TMPDIR" chgrp $SGID "$TMPDIR"
chmod g+rwx "$TMPDIR" chmod g+rwx "$TMPDIR"

View File

@ -0,0 +1,35 @@
diff --git a/Makefile.am b/Makefile.am
index 1f3ba33..56a36b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,11 +75,6 @@ $(generated_usage_sources) : usage2c.awk
# doc
include doc/doc.mk
-man_MANS = $(manpage)
-dist_doc_DATA = $(userguide_gen) doc/html.css $(txtguide)
-EXTRA_DIST += $(manpage_src) $(userguide_src) $(txtguide_src)
-EXTRA_DIST += $(buildfiles_docs) $(manpage)
-
CLEANFILES = version.h $(generated_usage_sources)
MAINTAINERCLEANFILES = $(manpage) $(userguide_gen) $(txtguide)
diff --git a/doc/doc.mk b/doc/doc.mk
index bde1e0e..d4633eb 100644
--- a/doc/doc.mk
+++ b/doc/doc.mk
@@ -28,6 +28,11 @@ EDIT_XML = $(XSLTPROC) \
if BUILD_DOCS
+man_MANS = $(manpage)
+dist_doc_DATA = $(userguide_gen) doc/html.css $(txtguide)
+EXTRA_DIST += $(manpage_src) $(userguide_src) $(txtguide_src)
+EXTRA_DIST += $(buildfiles_docs) $(manpage)
+
.xml.html:
$(V_DOCBOOK)$(EDIT_XML) $< | $(XSLTPROC) $(DOCBOOK_PARAMS) \
--stringparam html.stylesheet html.css \
--
2.18.0