From 2d27dff44edb970dcb3dfc74516b2e00c7eba14e Mon Sep 17 00:00:00 2001 From: TheSpad Date: Thu, 23 Feb 2023 11:55:55 +0000 Subject: [PATCH 1/2] Rebase to 3.17, migrate to s6v3 --- Dockerfile | 82 +++++++++++-------- Dockerfile.aarch64 | 82 +++++++++++-------- Dockerfile.armhf | 82 +++++++++++-------- README.md | 13 +-- readme-vars.yml | 54 ++---------- root/etc/cont-init.d/30-config | 10 --- .../dependencies.d/init-headphones-config | 0 .../dependencies.d/init-config | 0 .../s6-rc.d/init-headphones-config/run | 11 +++ .../s6-rc.d/init-headphones-config/type | 1 + .../s6-rc.d/init-headphones-config/up | 1 + .../dependencies.d/init-services | 0 .../s6-rc.d/svc-headphones/notification-fd | 1 + .../etc/s6-overlay/s6-rc.d/svc-headphones/run | 9 ++ .../s6-overlay/s6-rc.d/svc-headphones/type | 1 + .../user/contents.d/init-headphones-config | 0 .../s6-rc.d/user/contents.d/svc-headphones | 0 root/etc/services.d/headphones/run | 5 -- 18 files changed, 174 insertions(+), 178 deletions(-) delete mode 100644 root/etc/cont-init.d/30-config create mode 100644 root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-headphones-config create mode 100644 root/etc/s6-overlay/s6-rc.d/init-headphones-config/dependencies.d/init-config create mode 100755 root/etc/s6-overlay/s6-rc.d/init-headphones-config/run create mode 100644 root/etc/s6-overlay/s6-rc.d/init-headphones-config/type create mode 100644 root/etc/s6-overlay/s6-rc.d/init-headphones-config/up create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-headphones/dependencies.d/init-services create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-headphones/notification-fd create mode 100755 root/etc/s6-overlay/s6-rc.d/svc-headphones/run create mode 100644 root/etc/s6-overlay/s6-rc.d/svc-headphones/type create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/init-headphones-config create mode 100644 root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-headphones delete mode 100644 root/etc/services.d/headphones/run diff --git a/Dockerfile b/Dockerfile index 6816a03..8e9d2d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:3.17 # set version label ARG BUILD_DATE ARG VERSION +ARG HEADPHONES_COMMIT LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="aptalca" # hard set UTC in case the user does not define it @@ -12,41 +15,48 @@ ENV TZ="Etc/UTC" COPY patches/ /tmp/patches/ RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - g++ \ - gcc \ - make && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache \ - ffmpeg \ - flac \ - git \ - mc \ - python3 && \ - echo "**** compile shntool *** *" && \ - mkdir -p \ - /tmp/shntool && \ - tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \ - /tmp/shntool --strip-components=1 && \ - cp /tmp/patches/config.* /tmp/shntool && \ - cd /tmp/shntool && \ - ./configure \ - --infodir=/usr/share/info \ - --localstatedir=/var \ - --mandir=/usr/share/man \ - --prefix=/usr \ - --sysconfdir=/etc && \ - make && \ - make install && \ - echo "**** install app ****" && \ - git clone --depth 1 https://github.com/rembo10/headphones.git /app/headphones && \ - echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ - rm -rf \ - /tmp/* \ - /usr/lib/*.la + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ + build-base && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache \ + ffmpeg \ + flac \ + mc \ + python3 && \ + echo "**** compile shntool *** *" && \ + mkdir -p \ + /tmp/shntool && \ + tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \ + /tmp/shntool --strip-components=1 && \ + cp /tmp/patches/config.* /tmp/shntool && \ + cd /tmp/shntool && \ + ./configure \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --prefix=/usr \ + --sysconfdir=/etc && \ + make && \ + make install && \ + echo "**** install headphones ****" && \ + mkdir -p /app/headphones && \ + if [ -z ${HEADPHONES_COMMIT+x} ] ; then \ + HEADPHONES_COMMIT=$(curl -sX GET "https://api.github.com/repos/rembo10/headphones/commits/master" \ + | jq -r .sha); \ + fi && \ + curl -o \ + /tmp/headphones.tar.gz -sL \ + "https://github.com/rembo10/headphones/archive/${HEADPHONES_COMMIT}.tar.gz" && \ + tar xf \ + /tmp/headphones.tar.gz -C \ + /app/headphones --strip-components=1 && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + rm -rf \ + /tmp/* \ + /usr/lib/*.la # add local files COPY root/ / diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index e757821..45a18ff 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,8 +1,11 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:arm64v8-3.17 # set version label ARG BUILD_DATE ARG VERSION +ARG HEADPHONES_COMMIT LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="aptalca" # hard set UTC in case the user does not define it @@ -12,41 +15,48 @@ ENV TZ="Etc/UTC" COPY patches/ /tmp/patches/ RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - g++ \ - gcc \ - make && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache \ - ffmpeg \ - flac \ - git \ - mc \ - python3 && \ - echo "**** compile shntool *** *" && \ - mkdir -p \ - /tmp/shntool && \ - tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \ - /tmp/shntool --strip-components=1 && \ - cp /tmp/patches/config.* /tmp/shntool && \ - cd /tmp/shntool && \ - ./configure \ - --infodir=/usr/share/info \ - --localstatedir=/var \ - --mandir=/usr/share/man \ - --prefix=/usr \ - --sysconfdir=/etc && \ - make && \ - make install && \ - echo "**** install app ****" && \ - git clone --depth 1 https://github.com/rembo10/headphones.git /app/headphones && \ - echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ - rm -rf \ - /tmp/* \ - /usr/lib/*.la + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ + build-base && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache \ + ffmpeg \ + flac \ + mc \ + python3 && \ + echo "**** compile shntool *** *" && \ + mkdir -p \ + /tmp/shntool && \ + tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \ + /tmp/shntool --strip-components=1 && \ + cp /tmp/patches/config.* /tmp/shntool && \ + cd /tmp/shntool && \ + ./configure \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --prefix=/usr \ + --sysconfdir=/etc && \ + make && \ + make install && \ + echo "**** install headphones ****" && \ + mkdir -p /app/headphones && \ + if [ -z ${HEADPHONES_COMMIT+x} ] ; then \ + HEADPHONES_COMMIT=$(curl -sX GET "https://api.github.com/repos/rembo10/headphones/commits/master" \ + | jq -r .sha); \ + fi && \ + curl -o \ + /tmp/headphones.tar.gz -sL \ + "https://github.com/rembo10/headphones/archive/${HEADPHONES_COMMIT}.tar.gz" && \ + tar xf \ + /tmp/headphones.tar.gz -C \ + /app/headphones --strip-components=1 && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + rm -rf \ + /tmp/* \ + /usr/lib/*.la # add local files COPY root/ / diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 2445350..cb72c80 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,8 +1,11 @@ -FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.15 +# syntax=docker/dockerfile:1 + +FROM ghcr.io/linuxserver/baseimage-alpine:arm32v7-3.17 # set version label ARG BUILD_DATE ARG VERSION +ARG HEADPHONES_COMMIT LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL maintainer="aptalca" # hard set UTC in case the user does not define it @@ -12,41 +15,48 @@ ENV TZ="Etc/UTC" COPY patches/ /tmp/patches/ RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - g++ \ - gcc \ - make && \ - echo "**** install runtime packages ****" && \ - apk add --no-cache \ - ffmpeg \ - flac \ - git \ - mc \ - python3 && \ - echo "**** compile shntool *** *" && \ - mkdir -p \ - /tmp/shntool && \ - tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \ - /tmp/shntool --strip-components=1 && \ - cp /tmp/patches/config.* /tmp/shntool && \ - cd /tmp/shntool && \ - ./configure \ - --infodir=/usr/share/info \ - --localstatedir=/var \ - --mandir=/usr/share/man \ - --prefix=/usr \ - --sysconfdir=/etc && \ - make && \ - make install && \ - echo "**** install app ****" && \ - git clone --depth 1 https://github.com/rembo10/headphones.git /app/headphones && \ - echo "**** cleanup ****" && \ - apk del --purge \ - build-dependencies && \ - rm -rf \ - /tmp/* \ - /usr/lib/*.la + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies \ + build-base && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache \ + ffmpeg \ + flac \ + mc \ + python3 && \ + echo "**** compile shntool *** *" && \ + mkdir -p \ + /tmp/shntool && \ + tar xf /tmp/patches/shntool-3.0.10.tar.gz -C \ + /tmp/shntool --strip-components=1 && \ + cp /tmp/patches/config.* /tmp/shntool && \ + cd /tmp/shntool && \ + ./configure \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --mandir=/usr/share/man \ + --prefix=/usr \ + --sysconfdir=/etc && \ + make && \ + make install && \ + echo "**** install headphones ****" && \ + mkdir -p /app/headphones && \ + if [ -z ${HEADPHONES_COMMIT+x} ] ; then \ + HEADPHONES_COMMIT=$(curl -sX GET "https://api.github.com/repos/rembo10/headphones/commits/master" \ + | jq -r .sha); \ + fi && \ + curl -o \ + /tmp/headphones.tar.gz -sL \ + "https://github.com/rembo10/headphones/archive/${HEADPHONES_COMMIT}.tar.gz" && \ + tar xf \ + /tmp/headphones.tar.gz -C \ + /app/headphones --strip-components=1 && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + rm -rf \ + /tmp/* \ + /usr/lib/*.la # add local files COPY root/ / diff --git a/README.md b/README.md index 244b341..1271d13 100644 --- a/README.md +++ b/README.md @@ -76,9 +76,9 @@ services: - PGID=1000 - TZ=Etc/UTC volumes: - - :/config - - :/downloads - - :/music + - /path/to/appdata/config:/config + - /path/to/downloads:/downloads + - /path/to/music:/music ports: - 8181:8181 restart: unless-stopped @@ -93,9 +93,9 @@ docker run -d \ -e PGID=1000 \ -e TZ=Etc/UTC \ -p 8181:8181 \ - -v :/config \ - -v :/downloads \ - -v :/music \ + -v /path/to/appdata/config:/config \ + -v /path/to/downloads:/downloads \ + -v /path/to/music:/music \ --restart unless-stopped \ lscr.io/linuxserver/headphones:latest @@ -224,6 +224,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **23.02.23:** - Rebase to Alpine 3.17, migrate to s6v3. * **02.02.22:** - Rebasing to alpine 3.15. Updating to Python 3. * **19.12.19:** - Rebasing to alpine 3.11. * **28.06.19:** - Rebasing to alpine 3.10. diff --git a/readme-vars.yml b/readme-vars.yml index d4d9741..d4e90de 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -7,75 +7,31 @@ project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/ma project_blurb: "[{{ project_name|capitalize }}]({{ project_url }}) is an automated music downloader for NZB and Torrent, written in Python. It supports SABnzbd, NZBget, Transmission, µTorrent and Blackhole." project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}" -project_blurb_optional_extras_enabled: false -project_blurb_optional_extras: [] - # supported architectures available_architectures: - { arch: "{{ arch_x86_64 }}", tag: "amd64-latest"} - { arch: "{{ arch_arm64 }}", tag: "arm64v8-latest"} - { arch: "{{ arch_armhf }}", tag: "arm32v7-latest"} -# development version -development_versions: false -development_versions_items: - - { tag: "latest", desc: "Stable Ombi releases" } - - { tag: "development", desc: "Releases from the `develop` branch of Ombi" } - - # container parameters common_param_env_vars_enabled: true #PGID, PUID, etc, you can set it to 'optional' param_container_name: "{{ project_name }}" -param_usage_include_net: false #you can set it to 'optional' -param_net: "host" -param_net_desc: "Shares host networking with container." + param_usage_include_env: true param_env_vars: - { env_var: "TZ", env_value: "Europe/London", desc: "Specify a timezone to use EG Europe/London." } param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "", desc: "Configuration files." } - - { vol_path: "/downloads", vol_host_path: "", desc: "ISOs." } - - { vol_path: "/music", vol_host_path: "", desc: "Your music directory." } + - { vol_path: "/config", vol_host_path: "/path/to/appdata/config", desc: "Configuration files." } + - { vol_path: "/downloads", vol_host_path: "/path/to/downloads", desc: "ISOs." } + - { vol_path: "/music", vol_host_path: "/path/to/music", desc: "Your music directory." } param_usage_include_ports: true param_ports: - { external_port: "8181", internal_port: "8181", port_desc: "Application WebUI" } -param_device_map: false -param_devices: - - { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" } -cap_add_param: false -cap_add_param_vars: - - { cap_add_var: "NET_ADMIN" } - -# optional container parameters -opt_param_usage_include_env: false -opt_param_env_vars: - - { env_var: "VERSION", env_value: "latest", desc: "Supported values are LATEST, PLEXPASS or a specific version number." } -opt_param_usage_include_vols: false -opt_param_volumes: - - { vol_path: "/config", vol_host_path: "", desc: "Configuration files." } -opt_param_usage_include_ports: false -opt_param_ports: - - { external_port: "80", internal_port: "80", port_desc: "Application WebUI" } -opt_param_device_map: false -opt_param_devices: - - { device_path: "/dev/dri", device_host_path: "/dev/dri", desc: "For hardware transcoding" } -opt_cap_add_param: false -opt_cap_add_param_vars: - - { cap_add_var: "NET_ADMIN" } - -optional_block_1: false -optional_block_1_items: - - "```" - - "include optional stuff" - - "```" - -# application setup block -app_setup_block_enabled: false -app_setup_block: "" # changelog changelogs: + - { date: "23.02.23:", desc: "Rebase to Alpine 3.17, migrate to s6v3." } - { date: "02.02.22:", desc: "Rebasing to alpine 3.15. Updating to Python 3." } - { date: "19.12.19:", desc: "Rebasing to alpine 3.11." } - { date: "28.06.19:", desc: "Rebasing to alpine 3.10." } diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config deleted file mode 100644 index 23546a6..0000000 --- a/root/etc/cont-init.d/30-config +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/with-contenv bash - -# copy config -[[ ! -e /config/config.ini ]] && \ - cp /defaults/config.ini /config/config.ini - -# permissions -chown -R abc:abc \ - /app \ - /config diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-headphones-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-headphones-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-headphones-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-headphones-config/run b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/run new file mode 100755 index 0000000..9dfc334 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/run @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +# copy config +if [[ ! -f /config/config.ini ]]; then + cp /defaults/config.ini /config/config.ini +fi + +# permissions +lsiown -R abc:abc \ + /config diff --git a/root/etc/s6-overlay/s6-rc.d/init-headphones-config/type b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-headphones-config/up b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/up new file mode 100644 index 0000000..780fe2d --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-headphones-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-headphones-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/svc-headphones/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-headphones/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-headphones/notification-fd b/root/etc/s6-overlay/s6-rc.d/svc-headphones/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-headphones/notification-fd @@ -0,0 +1 @@ +3 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-headphones/run b/root/etc/s6-overlay/s6-rc.d/svc-headphones/run new file mode 100755 index 0000000..4784b41 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-headphones/run @@ -0,0 +1,9 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +PORT=$(grep "http_port" '/config/config.ini' | awk -F '=' '{print $2}' | tr -d ' ') + +exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PORT}" \ + s6-setuidgid abc python3 /app/headphones/Headphones.py \ + --datadir=/config diff --git a/root/etc/s6-overlay/s6-rc.d/svc-headphones/type b/root/etc/s6-overlay/s6-rc.d/svc-headphones/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-headphones/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-headphones-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-headphones-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-headphones b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-headphones new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/services.d/headphones/run b/root/etc/services.d/headphones/run deleted file mode 100644 index 65af626..0000000 --- a/root/etc/services.d/headphones/run +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/with-contenv bash - -exec \ - s6-setuidgid abc python3 /app/headphones/Headphones.py \ - --datadir=/config From cfd67bc626c041e38bf6649e22f4a07d0ec7f75e Mon Sep 17 00:00:00 2001 From: TheSpad Date: Sat, 25 Feb 2023 15:42:08 +0000 Subject: [PATCH 2/2] Write build commit to version.txt --- Dockerfile | 1 + Dockerfile.aarch64 | 1 + Dockerfile.armhf | 1 + 3 files changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 8e9d2d9..6851e0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,7 @@ RUN \ tar xf \ /tmp/headphones.tar.gz -C \ /app/headphones --strip-components=1 && \ + echo ${HEADPHONES_COMMIT} > /app/headphones/version.txt && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 45a18ff..9d8502f 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -51,6 +51,7 @@ RUN \ tar xf \ /tmp/headphones.tar.gz -C \ /app/headphones --strip-components=1 && \ + echo ${HEADPHONES_COMMIT} > /app/headphones/version.txt && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index cb72c80..dec9ff3 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -51,6 +51,7 @@ RUN \ tar xf \ /tmp/headphones.tar.gz -C \ /app/headphones --strip-components=1 && \ + echo ${HEADPHONES_COMMIT} > /app/headphones/version.txt && \ echo "**** cleanup ****" && \ apk del --purge \ build-dependencies && \