diff --git a/Dockerfile b/Dockerfile index 12832c3..a791f17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG alpine_version=edge ARG LICENSE=WTFPL \ IMAGE_NAME=music \ TIMEZONE=America/New_York \ - PORT=6600 + PORT=80 ENV SHELL=/bin/bash \ TERM=xterm-256color \ @@ -18,7 +18,8 @@ RUN mkdir -p /bin/ /config/ /data/ && \ echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/community" >> /etc/apk/repositories && \ echo "http://dl-cdn.alpinelinux.org/alpine/$alpine_version/testing" >> /etc/apk/repositories && \ apk update -U --no-cache && \ - apk add --no-cache mpd mpc navidrome + apk add --no-cache mpd mpc navidrome && \ + rm -Rf /etc/mpd.conf COPY ./bin/. /usr/local/bin/ COPY ./config/. /etc/ diff --git a/bin/entrypoint-music.sh b/bin/entrypoint-music.sh index 44be1b0..21b9dd0 100755 --- a/bin/entrypoint-music.sh +++ b/bin/entrypoint-music.sh @@ -47,14 +47,15 @@ __exec_bash() { return ${exitCode:-$?} } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -__mpd_start() { - pgrep mpd &>/dev/null || mpd --verbose /config/mpd/mpd.conf +__start() { + pgrep mpd &>/dev/null || mpd /config/mpd/mpd.conf sleep 10 - if pgrep mpd &>/dev/null; then + if pgrep mpd &>/dev/null; then mpc status 2>&1 | grep -q 'playing' || mpc play &>/dev/null - else + else echo "MPD seems to have not started" 1>&2 fi + navidrome --configfile "/config/navidrome/navidrome.toml" } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Define default variables @@ -147,8 +148,7 @@ healthcheck) # Docker healthcheck *) # Execute primary command if [ $# -eq 0 ]; then - __mpd_start & - navidrome --configfile "/config/navidrome/navidrome.toml" + __start else __exec_bash "$@" fi diff --git a/config/mpd/mpd.conf b/config/mpd/mpd.conf index 39b8f45..77e0d3f 100644 --- a/config/mpd/mpd.conf +++ b/config/mpd/mpd.conf @@ -1,10 +1,10 @@ # Files and directories ####################################################### music_directory "/data/music" playlist_directory "/data/playlists" -state_file "/data/mpd/state.txt" log_file "/data/mpd/mpd.log" pid_file "/data/mpd/mpd.pid" -db_file "/data/mpd/tag_cache.db" +db_file "/data/mpd/cache.db" +state_file "/data/mpd/state.txt" sticker_file "/data/mpd/sticker.sql" user "mpd" bind_to_address "0.0.0.0" @@ -23,22 +23,21 @@ zeroconf_name "mpd server" filesystem_charset "UTF-8" # Output ####################################################################### audio_output { - type "null" - name "This server does not need to play music, but it can" + type "null" + name "This server does not need to play music, but it can" } audio_output { - type "httpd" - name "stream" - encoder "lame" - port "8000" - bitrate "128" - max_clients "0" - mixer_type "software" - format "44100:16:2" - always_on "yes" + type "httpd" + name "stream" + encoder "lame" + port "8000" + bitrate "128" + max_clients "0" + mixer_type "software" + format "44100:16:2" } # Input ####################################################################### input { - plugin "curl" + plugin "curl" } ###############################################################################