From dc2f46be728e9936e81955bbe5e42d9d4b7f716a Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 4 Jul 2016 11:08:16 +0100 Subject: [PATCH 1/4] rebase to alpine --- Dockerfile | 15 +++++---------- README.md | 7 +++---- init/30_install_update_plexpy.sh | 16 ---------------- root/etc/cont-init.d/30-update | 12 ++++++++++++ root/etc/services.d/plexpy/run | 3 +++ services/plexpy/run | 3 --- 6 files changed, 23 insertions(+), 33 deletions(-) delete mode 100644 init/30_install_update_plexpy.sh create mode 100644 root/etc/cont-init.d/30-update create mode 100644 root/etc/services.d/plexpy/run delete mode 100644 services/plexpy/run diff --git a/Dockerfile b/Dockerfile index 867212f..17d2331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,9 @@ -FROM linuxserver/baseimage.python -MAINTAINER lonix +FROM lsiobase/alpine.python +MAINTAINER sparklyballs -#Adding Custom files -ADD init/ /etc/my_init.d/ -ADD services/ /etc/service/ -RUN chmod -v +x /etc/service/*/run /etc/my_init.d/*.sh +# add local files +COPY root/ / -# Volumes and Ports +# ports and volumes VOLUME /config /logs EXPOSE 8181 - - - diff --git a/README.md b/README.md index 34bad06..9f28763 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ docker create \ -v :/config \ -v :/logs:ro \ -e PGID= -e PUID= \ - -e ADVANCED_GIT_BRANCH= \ -p 8181:8181 \ linuxserver/plexpy ``` @@ -28,9 +27,8 @@ docker create \ * `-v /logs` Map this to PLex Media servers log directory - bonus points for mapping RO * `-e PGID` for GroupID - see below for explanation * `-e PUID` for UserID - see below for explanation -* `-e ADVANCED_GIT_BRANCH` to choose a specfic branch ( no support on the app if changed ) -It is based on phusion-baseimage with ssh removed, for shell access whilst the container is running do `docker exec -it plexpy /bin/bash`. +It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it plexpy /bin/bash`. ### User / Group Identifiers @@ -49,4 +47,5 @@ Part of what makes our containers work so well is by allowing you to specify you ## Versions -+ **16.07.2015:** Inital Release ++ **04.07.16:** Rebase to alpine linux for smaller image ++ **16.07.15:** Inital Release diff --git a/init/30_install_update_plexpy.sh b/init/30_install_update_plexpy.sh deleted file mode 100644 index 16f5d22..0000000 --- a/init/30_install_update_plexpy.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -chown -R abc:abc /config - -#If variable $ADVANCED_GIT_BRANCH, set branch to $ADVANCED_GIT_BRANCH, otherwise, default to master -[ "$ADVANCED_GIT_BRANCH" ] && \ -echo "BRANCH: $ADVANCED_GIT_BRANCH, Warning! This is unsupported." || ADVANCED_GIT_BRANCH="master" - -[[ ! -d /opt/plexpy/.git ]] && (echo "Cloning $ADVANCED_GIT_BRANCH branch..." && \ -git clone https://github.com/drzoidberg33/plexpy.git --branch $ADVANCED_GIT_BRANCH /opt/plexpy && \ -chown -R abc:abc /opt/plexpy/) - -# opt out for autoupdates -[ "$ADVANCED_DISABLEUPDATES" ] && exit 0 -cd /opt/plexpy -git pull -chown -R abc:abc /opt/plexpy/ diff --git a/root/etc/cont-init.d/30-update b/root/etc/cont-init.d/30-update new file mode 100644 index 0000000..60cdf34 --- /dev/null +++ b/root/etc/cont-init.d/30-update @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv bash + +#  +[[ ! -d "/opt/plexpy/.git" ]] && (git clone https://github.com/drzoidberg33/plexpy.git /opt/plexpy && \ +chown -R abc:abc /opt/plexpy) + + +# opt out for autoupdates +[ "$ADVANCED_DISABLEUPDATES" ] && exit 0 +cd /opt/plexpy +git pull +chown -R abc:abc /opt/plexpy diff --git a/root/etc/services.d/plexpy/run b/root/etc/services.d/plexpy/run new file mode 100644 index 0000000..c6b5329 --- /dev/null +++ b/root/etc/services.d/plexpy/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +exec s6-setuidgid abc python /opt/plexpy/PlexPy.py --datadir /config diff --git a/services/plexpy/run b/services/plexpy/run deleted file mode 100644 index 2e086a2..0000000 --- a/services/plexpy/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -exec /sbin/setuser abc /usr/bin/python /opt/plexpy/PlexPy.py --datadir /config - From bb0462b01b8d17e272e1fa214ad4b8469cfef2d7 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 4 Jul 2016 11:13:04 +0100 Subject: [PATCH 2/4] update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9f28763..ecc832b 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ The [LinuxServer.io](https://linuxserver.io) team brings you another quality con ``` docker create \ --name=plexpy \ - -v /etc/localtime:/etc/localtime:ro \ -v :/config \ -v :/logs:ro \ -e PGID= -e PUID= \ + -e TZ= \ -p 8181:8181 \ linuxserver/plexpy ``` @@ -27,6 +27,7 @@ docker create \ * `-v /logs` Map this to PLex Media servers log directory - bonus points for mapping RO * `-e PGID` for GroupID - see below for explanation * `-e PUID` for UserID - see below for explanation +* `-e TZ` for setting timezone information, eg Europe/London It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it plexpy /bin/bash`. From a35168ac795effd444a8f1eecceb5977aa6c08ad Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 4 Jul 2016 11:13:52 +0100 Subject: [PATCH 3/4] update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index ecc832b..f935895 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ docker create \ **Parameters** * `-p 8181` - Port for webui -* `-v /etc/localtime` for timesync - *optional* * `-v /config` Containes plexpy config and database * `-v /logs` Map this to PLex Media servers log directory - bonus points for mapping RO * `-e PGID` for GroupID - see below for explanation From 1bb8355017b887aadfd5cfec333c74d57946fcc6 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 8 Aug 2016 13:38:30 +0100 Subject: [PATCH 4/4] remove git update on startup, tidy readme, init and services files --- README.md | 23 +++++++++++++---------- root/etc/cont-init.d/30-install | 14 ++++++++++++++ root/etc/cont-init.d/30-update | 12 ------------ root/etc/services.d/plexpy/run | 4 +++- 4 files changed, 30 insertions(+), 23 deletions(-) create mode 100644 root/etc/cont-init.d/30-install delete mode 100644 root/etc/cont-init.d/30-update diff --git a/README.md b/README.md index f935895..60d9e31 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ ![https://linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) -The [LinuxServer.io](https://linuxserver.io) team brings you another quality container release featuring auto-update on startup, easy user mapping and community support. Be sure to checkout our [forums](https://forum.linuxserver.io) or for real-time support our [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io`. +The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring easy user mapping and community support. Find us for support at: +* [forum.linuxserver.io](https://forum.linuxserver.io) +* [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io` +* [Podcast](https://www.linuxserver.io/index.php/category/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation! # linuxserver/plexpy @@ -32,20 +35,20 @@ It is based on alpine linux with s6 overlay, for shell access whilst the contain ### User / Group Identifiers -**TL;DR** - The `PGID` and `PUID` values set the user / group you'd like your container to 'run as' to the host OS. This can be a user you've created or even root (not recommended). +Sometimes when using data volumes (`-v` flags) permissions issues can arise between the host OS and the container. We avoid this issue by allowing you to specify the user `PUID` and group `PGID`. Ensure the data volume directory on the host is owned by the same user you specify and it will "just work" ™. -Part of what makes our containers work so well is by allowing you to specify your own `PUID` and `PGID`. This avoids nasty permissions errors with relation to data volumes (`-v` flags). When an application is installed on the host OS it is normally added to the common group called users, Docker apps due to the nature of the technology can't be added to this group. So we added this feature to let you easily choose when running your containers. +In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as below: +``` + $ id + uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup) +``` +## Info -## Updates - -* Upgrade to the latest version simply `docker restart plexpy`. * To monitor the logs of the container in realtime `docker logs -f plexpy`. - - ## Versions -+ **04.07.16:** Rebase to alpine linux for smaller image -+ **16.07.15:** Inital Release ++ **08.08.16:** Rebase to alpine linux. ++ **16.07.15:** Inital Release. diff --git a/root/etc/cont-init.d/30-install b/root/etc/cont-init.d/30-install new file mode 100644 index 0000000..978d55d --- /dev/null +++ b/root/etc/cont-init.d/30-install @@ -0,0 +1,14 @@ +#!/usr/bin/with-contenv bash + +#If variable $ADVANCED_GIT_BRANCH, set branch to $ADVANCED_GIT_BRANCH, otherwise, default to master +[ "$ADVANCED_GIT_BRANCH" ] && \ + echo "Using this variable is unsupported., THERE IS NO PATH BACK TO MASTER GIT BRANCH OTHER THAN REMOVING EXISTING APPDATA FOLDER, WE MEAN IT WHEN WE SAY UNSUPPORTED" || \ + ADVANCED_GIT_BRANCH="master" + +# install app  +[[ ! -d "/opt/plexpy/.git" ]] && \ + git clone --branch $ADVANCED_GIT_BRANCH https://github.com/drzoidberg33/plexpy.git /opt/plexpy + +# permissions +chown -R abc:abc \ + /opt/plexpy diff --git a/root/etc/cont-init.d/30-update b/root/etc/cont-init.d/30-update deleted file mode 100644 index 60cdf34..0000000 --- a/root/etc/cont-init.d/30-update +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/with-contenv bash - -#  -[[ ! -d "/opt/plexpy/.git" ]] && (git clone https://github.com/drzoidberg33/plexpy.git /opt/plexpy && \ -chown -R abc:abc /opt/plexpy) - - -# opt out for autoupdates -[ "$ADVANCED_DISABLEUPDATES" ] && exit 0 -cd /opt/plexpy -git pull -chown -R abc:abc /opt/plexpy diff --git a/root/etc/services.d/plexpy/run b/root/etc/services.d/plexpy/run index c6b5329..e5511ce 100644 --- a/root/etc/services.d/plexpy/run +++ b/root/etc/services.d/plexpy/run @@ -1,3 +1,5 @@ #!/usr/bin/with-contenv bash -exec s6-setuidgid abc python /opt/plexpy/PlexPy.py --datadir /config +exec \ + s6-setuidgid abc python /opt/plexpy/PlexPy.py \ + --datadir /config