From 09912ed66e74910a974a4e1cc85898f45a410e0b Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 4 Jul 2016 12:47:42 +0100 Subject: [PATCH 1/3] rebase to alpine --- Dockerfile | 31 ++++++++----------- README.md | 10 +++--- init/40_check_config.sh | 8 ----- {defaults => root/defaults}/config.ini | 0 .../etc/cont-init.d/30-update | 2 +- root/etc/cont-init.d/40-config | 7 +++++ root/etc/services.d/headphones/run | 3 ++ services/headphones/run | 3 -- 8 files changed, 30 insertions(+), 34 deletions(-) mode change 100755 => 100644 Dockerfile delete mode 100644 init/40_check_config.sh rename {defaults => root/defaults}/config.ini (100%) rename init/30_update.sh => root/etc/cont-init.d/30-update (89%) mode change 100755 => 100644 create mode 100644 root/etc/cont-init.d/40-config create mode 100644 root/etc/services.d/headphones/run delete mode 100755 services/headphones/run diff --git a/Dockerfile b/Dockerfile old mode 100755 new mode 100644 index 89c33ed..f9f033c --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,18 @@ -FROM linuxserver/baseimage.python -MAINTAINER smdion +FROM lsiobase/alpine.python +MAINTAINER smdion ,sparklyballs -ENV PYTHONIOENCODING="UTF-8" -ENV APTLIST="ffmpeg mc shntool" +# install packages +RUN \ + apk add --no-cache \ + ffmpeg \ + mc && \ + apk add --no-cache --repository \ + http://nl.alpinelinux.org/alpine/edge/testing \ + shntool -# Install Dependencies -RUN add-apt-repository ppa:mc3man/trusty-media && \ -apt-get update && \ -apt-get install -qy $APTLIST && \ -apt-get clean && rm -rf /var/lib/apt/lists/* /var/tmp/* +# add local files +COPY root/ / -#Adding Custom files -ADD init/ /etc/my_init.d/ -ADD services/ /etc/service/ -ADD defaults/ /defaults -RUN chmod -v +x /etc/service/*/run /etc/my_init.d/*.sh - -#Volumes and Ports +# ports and volumes EXPOSE 8181 VOLUME ["/config", "/downloads", "/music"] - - diff --git a/README.md b/README.md index 725e7af..1cf7a37 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ docker create \ -v /path/to/headphones/data:/config \ -v /path/to/downloads:/downloads \ -v /path/to/music:/music \ - -v /etc/localtime:/etc/localtime:ro \ + -e PGID= -e PUID= \ + -e TZ= \ -p 8181:8181 \ linuxserver/headphones ``` @@ -23,14 +24,14 @@ docker create \ **Parameters** * `-p 8181` - the port(s) -* `-v /etc/localtime` for timesync - *optional* * `-v /config` - Configuration file location * `-v /music` - Location of music. (i.e. /opt/downloads/music or /var/music) * `-v /downloads` - Location of downloads folder * `-e PGID` for for GroupID - see below for explanation - *optional* * `-e PUID` for for UserID - see below for explanation - *optional* +* `-e TZ` for setting timezone information, eg Europe/London -It is based on phusion-baseimage with ssh removed, for shell access whilst the container is running do `docker exec -it Headphones /bin/bash`. +It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it Headphones /bin/bash`. ### User / Group Identifiers @@ -51,4 +52,5 @@ Access WebUI at http://localhost:8181 and walk through the wizard. ## Version History -+ **18.07.2015:** Inital Release ++ **04.07.16:** Rebase to alpine for smaller image size ++ **18.07.15:** Inital Release diff --git a/init/40_check_config.sh b/init/40_check_config.sh deleted file mode 100644 index 101087e..0000000 --- a/init/40_check_config.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - - -if [ ! -f /config/config.ini ]; then - cp /defaults/config.ini /config/config.ini - chown abc:abc /config/config.ini -fi - diff --git a/defaults/config.ini b/root/defaults/config.ini similarity index 100% rename from defaults/config.ini rename to root/defaults/config.ini diff --git a/init/30_update.sh b/root/etc/cont-init.d/30-update old mode 100755 new mode 100644 similarity index 89% rename from init/30_update.sh rename to root/etc/cont-init.d/30-update index 9459b82..925ec2e --- a/init/30_update.sh +++ b/root/etc/cont-init.d/30-update @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/with-contenv bash [[ ! -d /app/headphones/.git ]] && (git clone https://github.com/rembo10/headphones.git /app/headphones && \ chown -R abc:abc /app) diff --git a/root/etc/cont-init.d/40-config b/root/etc/cont-init.d/40-config new file mode 100644 index 0000000..9ff77ba --- /dev/null +++ b/root/etc/cont-init.d/40-config @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash + +[[ ! -e /config/config.ini ]] && cp /defaults/config.ini /config/config.ini + +chown abc:abc /config/* + + diff --git a/root/etc/services.d/headphones/run b/root/etc/services.d/headphones/run new file mode 100644 index 0000000..261b778 --- /dev/null +++ b/root/etc/services.d/headphones/run @@ -0,0 +1,3 @@ +#!/usr/bin/with-contenv bash + +exec s6-setuidgid abc python /app/headphones/Headphones.py -p 8181 --datadir=/config diff --git a/services/headphones/run b/services/headphones/run deleted file mode 100755 index db574df..0000000 --- a/services/headphones/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -exec /sbin/setuser abc python /app/headphones/Headphones.py -p 8181 --datadir=/config From 936c64dd9ec32efed904a58d605bc02849f762fd Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 8 Aug 2016 14:10:57 +0100 Subject: [PATCH 2/3] remove git update on startup, tidy readme, init and services files --- Dockerfile | 4 ++-- README.md | 23 ++++++++++++++--------- root/etc/cont-init.d/30-install | 9 +++++++++ root/etc/cont-init.d/30-update | 13 ------------- root/etc/cont-init.d/40-config | 8 ++++++-- root/etc/services.d/headphones/run | 4 +++- 6 files changed, 34 insertions(+), 27 deletions(-) create mode 100644 root/etc/cont-init.d/30-install delete mode 100644 root/etc/cont-init.d/30-update diff --git a/Dockerfile b/Dockerfile index f9f033c..cea26f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN \ ffmpeg \ mc && \ apk add --no-cache --repository \ - http://nl.alpinelinux.org/alpine/edge/testing \ + http://nl.alpinelinux.org/alpine/edge/testing \ shntool # add local files @@ -15,4 +15,4 @@ COPY root/ / # ports and volumes EXPOSE 8181 -VOLUME ["/config", "/downloads", "/music"] +VOLUME /config /downloads /music diff --git a/README.md b/README.md index 1cf7a37..411e865 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ -![http://linuxserver.io](http://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png) +![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/Headphones ![https://github.com/rembo10/headphones](http://i.imgur.com/5vSV3Gkl.png) @@ -35,22 +38,24 @@ 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) +``` ## Setting up the application Access WebUI at http://localhost:8181 and walk through the wizard. -## Updates +## Info -* Upgrade to the latest version simply `docker restart Headphones`. * To monitor the logs of the container in realtime `docker logs -f Headphones`. - - ## Version History -+ **04.07.16:** Rebase to alpine for smaller image size ++ **08.08.16:** Rebase to alpine linux. + **18.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..ea199c5 --- /dev/null +++ b/root/etc/cont-init.d/30-install @@ -0,0 +1,9 @@ +#!/usr/bin/with-contenv bash + +# install app +[[ ! -d /app/headphones/.git ]] && \ + git clone https://github.com/rembo10/headphones.git /app/headphones + +# permissions +chown -R abc:abc \ + /app diff --git a/root/etc/cont-init.d/30-update b/root/etc/cont-init.d/30-update deleted file mode 100644 index 925ec2e..0000000 --- a/root/etc/cont-init.d/30-update +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/with-contenv bash - -[[ ! -d /app/headphones/.git ]] && (git clone https://github.com/rembo10/headphones.git /app/headphones && \ -chown -R abc:abc /app) - - -# opt out for autoupdates -[ "$ADVANCED_DISABLEUPDATES" ] && exit 0 - -cd /app/headphones -git pull -chown -R abc:abc /app - diff --git a/root/etc/cont-init.d/40-config b/root/etc/cont-init.d/40-config index 9ff77ba..1cdb53a 100644 --- a/root/etc/cont-init.d/40-config +++ b/root/etc/cont-init.d/40-config @@ -1,7 +1,11 @@ #!/usr/bin/with-contenv bash -[[ ! -e /config/config.ini ]] && cp /defaults/config.ini /config/config.ini +# copy config +[[ ! -e /config/config.ini ]] && \ + cp /defaults/config.ini /config/config.ini -chown abc:abc /config/* +# permissions +chown abc:abc \ + /config/* diff --git a/root/etc/services.d/headphones/run b/root/etc/services.d/headphones/run index 261b778..a210708 100644 --- a/root/etc/services.d/headphones/run +++ b/root/etc/services.d/headphones/run @@ -1,3 +1,5 @@ #!/usr/bin/with-contenv bash -exec s6-setuidgid abc python /app/headphones/Headphones.py -p 8181 --datadir=/config +exec \ + s6-setuidgid abc python /app/headphones/Headphones.py -p 8181 \ + --datadir=/config From 87d0d5712f15b1e6c5d16e75c10366861f541007 Mon Sep 17 00:00:00 2001 From: sparklyballs Date: Mon, 8 Aug 2016 14:14:19 +0100 Subject: [PATCH 3/3] remove git update on startup, tidy readme, init and services files --- root/etc/cont-init.d/40-config | 2 -- 1 file changed, 2 deletions(-) diff --git a/root/etc/cont-init.d/40-config b/root/etc/cont-init.d/40-config index 1cdb53a..9a26234 100644 --- a/root/etc/cont-init.d/40-config +++ b/root/etc/cont-init.d/40-config @@ -7,5 +7,3 @@ # permissions chown abc:abc \ /config/* - -