diff --git a/Dockerfile b/Dockerfile index 63dd33d..d1a8d81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,20 +16,22 @@ RUN \ && echo "* Installing Runtime Packages" \ && apk add -U --no-cache \ coreutils \ - libcdio \ - libcaca \ + su-exec \ libxml2-dev \ libxslt-dev \ - libvpx \ libffi-dev \ openssl-dev \ - v4l-utils-libs \ python2-dev \ + libcdio \ + libcaca \ + libvpx \ + v4l-utils-libs \ py2-crypto \ py2-gst \ py-gobject \ mailcap \ - su-exec \ + icecast \ + snapcast-server \ gstreamer \ gst-plugins-base \ gst-plugins-good \ @@ -52,7 +54,14 @@ RUN \ && echo "* Creating Mopidy User" \ && addgroup -g ${PGID} mopidy \ && adduser -h /mopidy -s /bin/sh -D -G mopidy -u ${PUID} mopidy \ + && echo "mopidy ALL=NOPASSWD: /usr/local/lib/pyenv/versions/2.7.16/lib/python2.7/site-packages/mopidy_iris/system.sh" >> /etc/sudoers \ && echo "* Cleaning up" \ + && apk --purge del \ + libxml2-dev \ + libxslt-dev \ + libffi-dev \ + openssl-dev \ + python2-dev \ && rm -rf /var/cache/apk/* \ && rm -rf /tmp/* \ && echo "* Ready to start Mopidy" \ @@ -61,7 +70,7 @@ RUN \ COPY root/ / RUN chmod +x /usr/local/bin/run.sh RUN chmod +x /usr/local/bin/entrypoint.sh -EXPOSE 6600 6680 8000 5555/udp +EXPOSE 6600 6680 8000 1704 1705 VOLUME /data /music /playlists LABEL description "Open source media server" diff --git a/root/defaults/icecast.xml b/root/defaults/icecast.xml new file mode 100644 index 0000000..dbc68f5 --- /dev/null +++ b/root/defaults/icecast.xml @@ -0,0 +1,41 @@ + + icecast.local + local + noreply@icecast.local + 1 + + + 0 + + + + hackme + hackme + admin + hackme + + + + 8000 + 0.0.0.0 + + + + /mopidy + /silence.mp3 + 1 + + + + /data/icecast/logs + /data/icecast/web + /data/icecast/admin + + + + + + 3 + 10000 + + diff --git a/root/defaults/mopidy.conf b/root/defaults/mopidy.conf index 3983f0d..eecd525 100755 --- a/root/defaults/mopidy.conf +++ b/root/defaults/mopidy.conf @@ -1,10 +1,10 @@ [core] -cache_dir = /data/.cache -config_dir = /data/.config data_dir = /data +config_dir = /data/.config +cache_dir = /data/.cache [audio] -output = audioresample ! audioconvert ! audio/x-raw,rate=48000,channels=2,format=S16LE ! wavenc ! filesink location=/tmp/snapfifo +output = lamemp3enc bitrate=320 ! shout2send async=false mount=mopidy ip=0.0.0.0 port=8000 password=hackme [file] media_dirs = /music|Music @@ -12,6 +12,7 @@ media_dirs = /music|Music [local] library = images media_dir = /music +scan_flush_threshold = 100 [local-images] library = sqlite @@ -28,3 +29,27 @@ snapcast_host = snapserver snapcast_port = 1705 country = US locale = en_US + +[spotify] +username = +password = +client_id = +client_secret = +bitrate = 320 + +[spotify_web] +client_id = +client_secret = + +[gmusic] +username = +password = +deviceid = mac +bitrate = 320 + +[soundcloud] +auth_token = + +[scrobbler] +username = +password = diff --git a/root/defaults/silence.mp3 b/root/defaults/silence.mp3 new file mode 100644 index 0000000..16de7c3 Binary files /dev/null and b/root/defaults/silence.mp3 differ diff --git a/root/usr/local/bin/entrypoint.sh b/root/usr/local/bin/entrypoint.sh index 90387f3..80ac064 100644 --- a/root/usr/local/bin/entrypoint.sh +++ b/root/usr/local/bin/entrypoint.sh @@ -7,6 +7,17 @@ if [ ! -r /data/.config/mopidy.conf ]; then cp /defaults/mopidy.conf /data/.config fi +if [ ! -r /data/.config/icecast.xml ]; then + mkdir -p /data/.config + cp /defaults/icecast.xml /data/.config +fi + +if [ ! -r /data/icecast ]; then + mkdir -p /data/icecast/logs + cp -r /usr/share/icecast /data/icecast + cp /defaults/silence.mp3 /data/icecast/web/silence.mp3 +fi + chown -R mopidy:mopidy /data su-exec mopidy mopidy --config /data/.config/mopidy.conf local scan diff --git a/root/usr/local/bin/run.sh b/root/usr/local/bin/run.sh index 2e7c7d7..5497285 100755 --- a/root/usr/local/bin/run.sh +++ b/root/usr/local/bin/run.sh @@ -1,6 +1,8 @@ #!/bin/sh trap "kill $PID" HUP INT TERM +su-exec mopidy snapserver -s pipe:///tmp/snapfifo?name=Mopidy&sampleformat=48000:16:2 -d & +su-exec mopidy icecast -c /data/.config/icecast.xml -b & su-exec mopidy mopidy --config /data/.config/mopidy.conf "${@}" & PID=$! wait $PID