diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..82bfa87 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM phusion/baseimage:0.9.15 +MAINTAINER Stian Larsen +RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh +ENV DEBIAN_FRONTEND noninteractive +ENV HOME /root + + +# Use baseimage-docker's init system +CMD ["/sbin/my_init"] + + +# Install Plex +RUN apt-get -q update && \ +apt-get install -qy gdebi-core wget && \ +wget -P /tmp http://downloads.plexapp.com/plex-media-server/0.9.9.14.531-7eef8c6/plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb && \ +gdebi -n /tmp/plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb && \ +rm -f /tmp/plexmediaserver_0.9.9.14.531-7eef8c6_amd64.deb && \ +apt-get clean && \ +rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +#Mappings and ports +VOLUME /config +VOLUME /data +EXPOSE 32400 + + +# Define /config in the configuration file not using environment variables +ADD plexmediaserver /etc/default/plexmediaserver + +#Adding Custom files +ADD init/ /etc/my_init.d/ +ADD services/ /etc/service/ +RUN chmod -v +x /etc/service/*/run +RUN chmod -v +x /etc/my_init.d/*.sh diff --git a/README.md b/README.md index cfa16a4..24058a4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ -# plexmediaserver -The linuxserver.io version of plexmediaserver (built from lonix's original) +lonix/plex +============= +plexp. with or without plexpass to run the latest edition + + +sample command: +``` +docker run -d --name=plex --net=host -v /etc/localtime:/etc/localtime:ro -v :/config -v :/data -e PUID=996 -e PGID=996 -e PLEXPASS=1 -p 32400:32400 lonix/plex:1.2 +``` + +You need to map +* --net=host for streaming to work. +* Port 32400 for plex web-app. +* Mount /config for plex config files. +* Mount /data for plex media files +* Mount /etc/localhost for timesync (Not required) +* PLEXPASS set to 1 for Plexpass version, UNSET for Public +* GUID and GPID set toyou local plex user group (you may need to create a user on the host (named plex)) + + +This container will update plex on each launch (if update found). It is based on phusion-baseimage with ssh removed. (use nsenter). +If the app does not update to the latest version, i need to update a file on server, msg me at + +**Credits** +* needo +* Eric Schultz +* Tim Haak diff --git a/init/10_dbus.sh b/init/10_dbus.sh new file mode 100644 index 0000000..69963cf --- /dev/null +++ b/init/10_dbus.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [ -e /var/run/dbus/pid ]; then rm -f /var/run/dbus/pid; fi +mkdir -p /var/run/dbus +chown messagebus:messagebus /var/run/dbus +dbus-uuidgen --ensure +sleep 1 diff --git a/init/20_update_plex.sh b/init/20_update_plex.sh new file mode 100644 index 0000000..f83a117 --- /dev/null +++ b/init/20_update_plex.sh @@ -0,0 +1,16 @@ +#!/bin/bash +export DEBIAN_FRONTEND=noninteractive +INSTALLED=`dpkg-query -W -f='${Version}' plexmediaserver` +if [ -z "$PLEXPASS" ]; then + VERSION=$(curl https://lonix.me/mirror/plex/plexPub.ver) +else + VERSION=$(curl https://lonix.me/mirror/plex/plexPass.ver) +fi +if [ "$VERSION" == "$INSTALLED" ]; then +exit 0; +fi +mv /etc/default/plexmediaserver /tmp/ +apt-get remove --purge -y plexmediaserver +wget -P /tmp "http://downloads.plexapp.com/plex-media-server/$VERSION/plexmediaserver_${VERSION}_amd64.deb" +gdebi -n /tmp/plexmediaserver_${VERSION}_amd64.deb +mv /tmp/plexmediaserver /etc/default/ diff --git a/init/90_uid_gid_fix.sh b/init/90_uid_gid_fix.sh new file mode 100644 index 0000000..bc9c79f --- /dev/null +++ b/init/90_uid_gid_fix.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ ! "$(id -u plex)" -eq "$PUID" ]; then usermod -u "$PUID" plex ; fi +if [ ! "$(id -g plex)" -eq "$PGID" ]; then groupmod -g "$PGID" plex ; fi + +echo " +----------------------------------- +PLEX GID/UID +----------------------------------- +Plex uid: $(id -u plex) +Plex gid: $(id -g plex) +----------------------------------- +Plex will now continue to boot. +" +sleep 2 \ No newline at end of file diff --git a/plexmediaserver b/plexmediaserver new file mode 100644 index 0000000..605fb17 --- /dev/null +++ b/plexmediaserver @@ -0,0 +1,19 @@ +# default script for Plex Media Server + +# the number of plugins that can run at the same time +PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6 + +# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE +PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000 + +# where the mediaserver should store the transcodes +PLEX_MEDIA_SERVER_TMPDIR=/tmp + +# uncomment to set it to something else +PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support" + +# the user that PMS should run as, defaults to 'plex' +# note that if you change this you might need to move +# the Application Support directory to not lose your +# media library +PLEX_MEDIA_SERVER_USER=plex diff --git a/services/avahi/run b/services/avahi/run new file mode 100644 index 0000000..3ebaef3 --- /dev/null +++ b/services/avahi/run @@ -0,0 +1,3 @@ +#!/bin/bash + +exec avahi-daemon --no-chroot diff --git a/services/dbus/run b/services/dbus/run new file mode 100644 index 0000000..b8b26b8 --- /dev/null +++ b/services/dbus/run @@ -0,0 +1,3 @@ +#!/bin/bash + +exec dbus-daemon --system --nofork diff --git a/services/plex/run b/services/plex/run new file mode 100644 index 0000000..db92d20 --- /dev/null +++ b/services/plex/run @@ -0,0 +1,3 @@ +#!/bin/bash + +exec /sbin/setuser plex /usr/sbin/start_pms