From 467142db01bd93f6d79ed0c5cc9a5735a84b9e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 5 Oct 2022 10:13:39 +0200 Subject: [PATCH] Add Dockerfile and root folder from upstream --- Dockerfile | 121 +++++++++++++++++++++++++++++++-- root/defaults/beets.sh | 26 +++++++ root/defaults/config.yaml | 63 +++++++++++++++++ root/etc/cont-init.d/30-config | 11 +++ root/etc/services.d/beets/run | 5 ++ 5 files changed, 221 insertions(+), 5 deletions(-) create mode 100644 root/defaults/beets.sh create mode 100644 root/defaults/config.yaml create mode 100644 root/etc/cont-init.d/30-config create mode 100644 root/etc/services.d/beets/run diff --git a/Dockerfile b/Dockerfile index b3abea6..c83c2f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,116 @@ -FROM scratch -RUN echo "hello world" -COPY example.txt / -ENV VAR=1 -CMD ["sleep", "infinity"] \ No newline at end of file +FROM ghcr.io/linuxserver/baseimage-alpine:3.15 + +# set version label +ARG BUILD_DATE +ARG VERSION +ARG BEETS_VERSION +LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" +LABEL maintainer="aptalca" + +RUN \ + echo "**** install build packages ****" && \ + apk add --no-cache --virtual=build-dependencies --upgrade \ + cmake \ + ffmpeg-dev \ + fftw-dev \ + g++ \ + gcc \ + git \ + jpeg-dev \ + libpng-dev \ + make \ + mpg123-dev \ + openjpeg-dev \ + python3-dev && \ + echo "**** install runtime packages ****" && \ + apk add --no-cache --upgrade \ + curl \ + expat \ + ffmpeg \ + ffmpeg-libs \ + fftw \ + flac \ + gdbm \ + gst-plugins-good \ + gstreamer \ + jpeg \ + jq \ + lame \ + libffi \ + libpng \ + mpg123 \ + nano \ + openjpeg \ + py3-gobject3 \ + py3-pip \ + py3-pylast \ + python3 \ + sqlite-libs \ + tar \ + wget && \ + echo "**** compile mp3gain ****" && \ + mkdir -p \ + /tmp/mp3gain-src && \ + curl -o \ + /tmp/mp3gain-src/mp3gain.zip -sL \ + https://sourceforge.net/projects/mp3gain/files/mp3gain/1.6.1/mp3gain-1_6_1-src.zip && \ + cd /tmp/mp3gain-src && \ + unzip -qq /tmp/mp3gain-src/mp3gain.zip && \ + sed -i "s#/usr/local/bin#/usr/bin#g" /tmp/mp3gain-src/Makefile && \ + make && \ + make install && \ + echo "**** compile mp3val ****" && \ + mkdir -p \ + /tmp/mp3val-src && \ + curl -o \ + /tmp/mp3val-src/mp3val.tar.gz -sL \ + https://downloads.sourceforge.net/mp3val/mp3val-0.1.8-src.tar.gz && \ + cd /tmp/mp3val-src && \ + tar xzf /tmp/mp3val-src/mp3val.tar.gz --strip 1 && \ + make -f Makefile.linux && \ + cp -p mp3val /usr/bin && \ + echo "**** compile chromaprint ****" && \ + git clone https://bitbucket.org/acoustid/chromaprint.git \ + /tmp/chromaprint && \ + cd /tmp/chromaprint && \ + cmake \ + -DBUILD_TOOLS=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX:PATH=/usr && \ + make && \ + make install && \ + echo "**** install pip packages ****" && \ + if [ -z ${BEETS_VERSION+x} ]; then \ + BEETS_VERSION=$(curl -sL https://pypi.python.org/pypi/beets/json \ + |jq -r '. | .info.version'); \ + fi && \ + python3 -m pip install --upgrade pip && \ + pip3 install -U --no-cache-dir --find-links https://wheel-index.linuxserver.io/alpine/ \ + wheel \ + beautifulsoup4 \ + beets==${BEETS_VERSION} \ + beets-extrafiles \ + discogs-client \ + flask \ + pillow \ + pyacoustid \ + requests \ + unidecode && \ + echo "**** cleanup ****" && \ + apk del --purge \ + build-dependencies && \ + rm -rf \ + /root/.cache \ + /tmp/* + +# environment settings +ENV BEETSDIR="/config" \ +EDITOR="nano" \ +HOME="/config" + +# copy local files +COPY root/ / + +# ports and volumes +EXPOSE 8337 +VOLUME /config diff --git a/root/defaults/beets.sh b/root/defaults/beets.sh new file mode 100644 index 0000000..1697b50 --- /dev/null +++ b/root/defaults/beets.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# beets music tagger - post-processing script +# +# Author: Rich Manton (overbyrn) +# Date: 29-04-13 +# +# $1 - Fullpath of directory to be processed. eg./mnt/user/downloads/some.artist_some.album + +# $7 - Status of post processing. 0 = OK, 1 = failed verification, 2 = failed unpack, 3 = 1+2 +if [ ! -z "$7" ] && [ "$7" -gt 0 ]; then + echo "post-processing failed, bypassing script" + exit 1 +fi + +# process files +echo "--------------------------" +printf %b "$(date)\n" +echo "Starting beets.sh for $(basename $1)" + +BEETSDIR=/config +export BEETSDIR +FPCALC=/usr/bin/fpcalc +export FPCALC +/usr/bin/beet -v import -q "$1" + diff --git a/root/defaults/config.yaml b/root/defaults/config.yaml new file mode 100644 index 0000000..64c6f6c --- /dev/null +++ b/root/defaults/config.yaml @@ -0,0 +1,63 @@ +plugins: fetchart embedart convert scrub replaygain lastgenre chroma web +directory: /music +library: /config/musiclibrary.blb +art_filename: albumart +threaded: yes +original_date: no +per_disc_numbering: no + +convert: + auto: no + ffmpeg: /usr/bin/ffmpeg + opts: -ab 320k -ac 2 -ar 48000 + max_bitrate: 320 + threads: 1 + +paths: + default: $albumartist/$album%aunique{}/$track - $title + singleton: Non-Album/$artist - $title + comp: Compilations/$album%aunique{}/$track - $title + albumtype_soundtrack: Soundtracks/$album/$track $title + +import: + write: yes + copy: no + move: yes + resume: ask + incremental: yes + quiet_fallback: skip + timid: no + log: /config/beet.log + +lastgenre: + auto: yes + source: album + +embedart: + auto: yes + +fetchart: + auto: yes + +replaygain: + auto: no + +scrub: + auto: yes + +replace: + '^\.': _ + '[\x00-\x1f]': _ + '[<>:"\?\*\|]': _ + '[\xE8-\xEB]': e + '[\xEC-\xEF]': i + '[\xE2-\xE6]': a + '[\xF2-\xF6]': o + '[\xF8]': o + '\.$': _ + '\s+$': '' + +web: + host: 0.0.0.0 + port: 8337 + diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config new file mode 100644 index 0000000..472eeda --- /dev/null +++ b/root/etc/cont-init.d/30-config @@ -0,0 +1,11 @@ +#!/usr/bin/with-contenv bash + +# copy config +[[ ! -e /config/beets.sh ]] && \ + cp /defaults/beets.sh /config/beets.sh +[[ ! -e /config/config.yaml ]] && \ + cp /defaults/config.yaml /config/config.yaml + +# permissions +chown -R abc:abc \ + /config diff --git a/root/etc/services.d/beets/run b/root/etc/services.d/beets/run new file mode 100644 index 0000000..28bb1ab --- /dev/null +++ b/root/etc/services.d/beets/run @@ -0,0 +1,5 @@ +#!/usr/bin/with-contenv bash +umask 022 + +exec \ + s6-setuidgid abc beet web