diff --git a/Dockerfile b/Dockerfile index b179b9d..e1e47e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -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 @@ -10,10 +12,6 @@ LABEL maintainer="chbmb" ENV HOME="/config" RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - curl \ - git && \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ nodejs \ @@ -33,14 +31,13 @@ RUN \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ cd /opt/mstream && \ - npm install --only=production && \ + npm install --omit=dev && \ npm link && \ echo "**** cleanup ****" && \ npm cache clean --force && \ rm -rf /opt/mstream/save/sync && \ + rm -rf /config/.npm && \ ln -s /config/sync /opt/mstream/save/sync && \ - apk del --purge \ - build-dependencies && \ rm -rf \ /tmp/* @@ -49,4 +46,4 @@ COPY root/ / # ports and volumes EXPOSE 3000 -VOLUME /config /music +VOLUME /config diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 19f126e..7e98292 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,4 +1,6 @@ -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 @@ -10,10 +12,6 @@ LABEL maintainer="chbmb" ENV HOME="/config" RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - curl \ - git && \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ nodejs \ @@ -29,18 +27,17 @@ RUN \ curl -o \ /tmp/mstream.tar.gz -L \ "https://github.com/IrosTheBeggar/mStream/archive/${MSTREAM_RELEASE}.tar.gz" && \ - tar xf \ + tar xzf \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ cd /opt/mstream && \ - npm install --only=production && \ + npm install --omit=dev && \ npm link && \ echo "**** cleanup ****" && \ npm cache clean --force && \ rm -rf /opt/mstream/save/sync && \ + rm -rf /config/.npm && \ ln -s /config/sync /opt/mstream/save/sync && \ - apk del --purge \ - build-dependencies && \ rm -rf \ /tmp/* @@ -49,4 +46,4 @@ COPY root/ / # ports and volumes EXPOSE 3000 -VOLUME /config /music +VOLUME /config diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 2f392e4..bcf7f27 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -1,4 +1,6 @@ -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 @@ -10,10 +12,6 @@ LABEL maintainer="chbmb" ENV HOME="/config" RUN \ - echo "**** install build packages ****" && \ - apk add --no-cache --virtual=build-dependencies \ - curl \ - git && \ echo "**** install runtime packages ****" && \ apk add --no-cache --upgrade \ nodejs \ @@ -29,18 +27,17 @@ RUN \ curl -o \ /tmp/mstream.tar.gz -L \ "https://github.com/IrosTheBeggar/mStream/archive/${MSTREAM_RELEASE}.tar.gz" && \ - tar xf \ + tar xzf \ /tmp/mstream.tar.gz -C \ /opt/mstream/ --strip-components=1 && \ cd /opt/mstream && \ - npm install --only=production && \ + npm install --omit=dev && \ npm link && \ echo "**** cleanup ****" && \ npm cache clean --force && \ rm -rf /opt/mstream/save/sync && \ + rm -rf /config/.npm && \ ln -s /config/sync /opt/mstream/save/sync && \ - apk del --purge \ - build-dependencies && \ rm -rf \ /tmp/* @@ -49,4 +46,4 @@ COPY root/ / # ports and volumes EXPOSE 3000 -VOLUME /config /music +VOLUME /config diff --git a/README.md b/README.md index be1eea9..1ab48ea 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **13.02.23:** - Rebase to Alpine 3.17, migrate to s6v3. * **05.04.22:** - Move `sync` folder to `/config`. * **02.04.22:** - Rebase to alpine 3.15. Fix ffmpeg download. * **17.05.21:** - Deprecating the env vars `USER`, `PASSWORD` and `USE_JSON` as mStream v5 requires the use of `config.json`. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 46885a3..e170628 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -1,5 +1,5 @@ --- - # jenkins variables +# jenkins variables project_name: docker-mstream external_type: github_stable release_type: stable @@ -25,4 +25,4 @@ repo_vars: - CI_DELAY='120' - CI_DOCKERENV='TZ=US/Pacific' - CI_AUTH='user:password' - - CI_WEBPATH='' \ No newline at end of file + - CI_WEBPATH='' diff --git a/readme-vars.yml b/readme-vars.yml index d50c509..5427328 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -37,6 +37,7 @@ app_setup_block: | # changelog changelogs: + - { date: "13.02.23:", desc: "Rebase to Alpine 3.17, migrate to s6v3." } - { date: "05.04.22:", desc: "Move `sync` folder to `/config`." } - { date: "02.04.22:", desc: "Rebase to alpine 3.15. Fix ffmpeg download." } - { date: "17.05.21:", desc: "Deprecating the env vars `USER`, `PASSWORD` and `USE_JSON` as mStream v5 requires the use of `config.json`." } diff --git a/root/etc/cont-init.d/20-certs b/root/etc/cont-init.d/20-certs deleted file mode 100644 index 81f538b..0000000 --- a/root/etc/cont-init.d/20-certs +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/with-contenv bash - -# make our folders -[[ ! -d /config/keys ]] && \ -mkdir -p \ - /config/keys - -# create keys -[[ ! -e /config/keys/certificate.pem ]] && \ - openssl req -x509 -nodes -days 3650 \ - -newkey rsa:2048 -keyout /config/keys/private-key.pem -out /config/keys/certificate.pem \ - -subj "/CN=mstream" \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-mstream-config b/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-mstream-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/init-mstream-config/dependencies.d/init-config b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/dependencies.d/init-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/cont-init.d/30-config b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/run old mode 100644 new mode 100755 similarity index 51% rename from root/etc/cont-init.d/30-config rename to root/etc/s6-overlay/s6-rc.d/init-mstream-config/run index 62e67f1..58a04c6 --- a/root/etc/cont-init.d/30-config +++ b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/run @@ -1,33 +1,20 @@ #!/usr/bin/with-contenv bash +# shellcheck shell=bash -# make folders mkdir -p \ - /config/{album-art,db,logs,sync} + /config/{album-art,db,keys,logs,sync} \ + /music + +# create keys +if [[ ! -e /config/keys/certificate.pem ]]; then + openssl req -x509 -nodes -days 3650 \ + -newkey rsa:2048 -keyout /config/keys/private-key.pem -out /config/keys/certificate.pem \ + -subj "/CN=mstream" +fi # copy config.json if doesn't exist -[[ ! -e /config/config.json ]] && \ +if [[ ! -e /config/config.json ]]; then cp /defaults/config.json /config/config.json - -# Backwards compatibility notice -if [ -n "$USER" ] || [ -n "$PASSWORD" ] || [ -n "$USE_JSON" ]; then - echo ' -************************************* -************************************* -**** **** -**** $USER, $PASSWORD and **** -**** **** -**** $USE_JSON env vars are **** -**** **** -**** deprecated. **** -**** **** -**** Please edit config.json **** -**** **** -**** or use the web ui to **** -**** **** -**** modify the settings. **** -**** **** -************************************* -*************************************' fi if grep -q '"webAppDirectory": "public"' /config/config.json; then @@ -52,7 +39,6 @@ if grep -q '"webAppDirectory": "public"' /config/config.json; then fi # permissions -chown abc:abc -R \ +lsiown -R abc:abc \ /config \ /opt/mstream/bin - \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-mstream-config/type b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/type @@ -0,0 +1 @@ +oneshot diff --git a/root/etc/s6-overlay/s6-rc.d/init-mstream-config/up b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/up new file mode 100644 index 0000000..81a6cc4 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/init-mstream-config/up @@ -0,0 +1 @@ +/etc/s6-overlay/s6-rc.d/init-mstream-config/run diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mstream/dependencies.d/init-services b/root/etc/s6-overlay/s6-rc.d/svc-mstream/dependencies.d/init-services new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mstream/notification-fd b/root/etc/s6-overlay/s6-rc.d/svc-mstream/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-mstream/notification-fd @@ -0,0 +1 @@ +3 diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mstream/run b/root/etc/s6-overlay/s6-rc.d/svc-mstream/run new file mode 100755 index 0000000..a74fa28 --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-mstream/run @@ -0,0 +1,8 @@ +#!/usr/bin/with-contenv bash +# shellcheck shell=bash + +PORT=$(jq -r '.port' /config/config.json) + +exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost ${PORT}" \ + cd /opt/mstream s6-setuidgid abc mstream -j /config/config.json diff --git a/root/etc/s6-overlay/s6-rc.d/svc-mstream/type b/root/etc/s6-overlay/s6-rc.d/svc-mstream/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/root/etc/s6-overlay/s6-rc.d/svc-mstream/type @@ -0,0 +1 @@ +longrun diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mstream-config b/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-mstream-config new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mstream b/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-mstream new file mode 100644 index 0000000..e69de29 diff --git a/root/etc/services.d/mstream/run b/root/etc/services.d/mstream/run deleted file mode 100644 index d835887..0000000 --- a/root/etc/services.d/mstream/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/with-contenv bash - -cd /opt/mstream || exit - -exec \ - s6-setuidgid abc mstream -j /config/config.json \ No newline at end of file