From c1fcb9458c06beca12bb152891b00bc58eac4a62 Mon Sep 17 00:00:00 2001 From: Wouter Habets Date: Mon, 28 Dec 2020 12:42:19 +0100 Subject: [PATCH] Upgrade to Mopidy 3 --- .dockerignore | 2 +- .gitignore | 2 ++ .gitlab-ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ Dockerfile | 43 +++++++++++++++++++++---------------------- README.md | 18 ++++++++---------- entrypoint.sh | 9 +-------- localscan | 2 +- mopidy.conf | 19 ------------------- test.sh | 6 +++--- 9 files changed, 77 insertions(+), 64 deletions(-) create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml diff --git a/.dockerignore b/.dockerignore index 6350f0f..8fce603 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1 @@ -test-data/ +data/ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cb5d883 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +data/ +accounts.conf \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..43e4a44 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,40 @@ +docker-master: + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE" . + - docker push "$CI_REGISTRY_IMAGE" + only: + - master + +docker-tag: + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" + only: + - tags + + +docker: + image: docker:latest + stage: build + services: + - docker:dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + except: + - master + diff --git a/Dockerfile b/Dockerfile index c3075eb..2795b87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,14 @@ -FROM debian:jessie -MAINTAINER Wouter Habets (wouterhabets@gmail.com) +FROM debian:buster +LABEL maintainer="wouter@habets.io" + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + python3 \ + python3-pip \ + git \ + gstreamer1.0-libav \ + python-crypto \ + python-setuptools RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -10,27 +19,18 @@ RUN apt-get update \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y \ mopidy \ + mopidy-mpd \ + mopidy-local \ mopidy-scrobbler \ mopidy-soundcloud \ mopidy-spotify \ - mopidy-spotify-tunigo \ - mopidy-tunein \ - git \ - gstreamer1.0-libav \ - python-crypto \ - python-setuptools + mopidy-tunein -RUN curl -L https://bootstrap.pypa.io/get-pip.py | python - -RUN pip install --ignore-installed Mopidy-Iris -RUN pip install -U six \ - && pip install markerlib \ - && pip install Mopidy-Local-SQLite \ - && pip install Mopidy-Local-Images \ - && pip install Mopidy-Party \ - && pip install Mopidy-Simple-Webclient \ - && pip install Mopidy-MusicBox-Webclient \ - && pip install Mopidy-API-Explorer \ - && pip install Mopidy-Mopify +#RUN curl -L https://bootstrap.pypa.io/get-pip.py | python3 - +RUN python3 -m pip install \ + Mopidy-Iris \ + Mopidy-MusicBox-Webclient \ + Mopidy-YouTube #ADD snapserver.deb /tmp/snapserver.deb #RUN apt-get install -y libavahi-client3 libavahi-common3 \ @@ -49,8 +49,6 @@ ADD localscan /usr/bin/localscan RUN chmod +x /usr/bin/localscan VOLUME /var/lib/mopidy -VOLUME /media -VOLUME /mopidy.conf EXPOSE 6600 EXPOSE 6680 @@ -59,4 +57,5 @@ EXPOSE 6681 USER mopidy ENTRYPOINT ["/entrypoint.sh"] -CMD ["/usr/bin/mopidy"] +CMD ["/usr/bin/mopidy", "--config", "/etc/mopidy.conf:/mopidy.conf"] + diff --git a/README.md b/README.md index 3cf6768..38e0e9f 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,17 @@ # Mopidy Docker image -Image for running [Mopidy](https://www.mopidy.com/) in Docker. +Image for running [Mopidy](https://www.mopidy.com/) in Docker. Uses Pulseaudio for audio output. ## Contents ### Frontend extensions * [Iris](https://github.com/jaedb/Iris) * [Mopidy Musicbox Webclient](https://github.com/pimusicbox/mopidy-musicbox-webclient) -* [Mopidy Party](https://github.com/Lesterpig/mopidy-party) -* [Mopidy Simple webclient](https://github.com/xolox/mopidy-simple-webclient) -* [API explorer](https://github.com/dz0ny/mopidy-api-explorer) -* [Local images](https://github.com/tkem/mopidy-local-images) ### Backend extensions * Spotify -* Spotify tunigo * Soundcloud * Scrobbler * Tunein -* Local SQLite ## How to use ```bash @@ -46,6 +40,10 @@ To add Spotify, Last.FM etc. accounts, use the `/mopidy.conf` file. Example: enabled = true username = password = +client_id = +client_secret = +# To authenticate go to: +# https://mopidy.com/ext/spotify/#authentication [scrobbler] enabled = true @@ -65,14 +63,14 @@ enable = true The complete default config can be found in the file [mopidy.conf](./mopidy.conf) ## Local media -To play local media files, mount `/media`. All meta data will be stored using Mopidy-Local-SQLite. To scan for new media files, run `docker exec -it mopidy localscan`. +To play local media files, mount `/media`. To scan for new media files, run `docker exec -it mopidy localscan`. ## Adding extensions To add extensions, I advice to override this image by creating your own Dockerfile. -In the example below, the material webclient is added. To add packages, we switch to the root user, run `pip` to add everything we need and switch back to the `mopidy` user. +In the example below, a package is installed with pip. To add packages, we switch to the root user, run `pip` to add everything we need and switch back to the `mopidy` user. ```Dockerfile FROM whhoesj/mopidy:latest USER root -RUN pip install +RUN python3 -m pip install USER mopidy ``` diff --git a/entrypoint.sh b/entrypoint.sh index 5094235..d13e3a6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,16 +1,9 @@ #!/bin/bash -echo "WARNING. Mopidy-Youtube is removed." -echo "There are a lot of issues with it and there is currently no maintainer." -echo "I'll add it back once there is a mainainer found for the package." -echo "" -echo "" echo "Starting container..." echo "Current user: $(whoami)" echo "Current user id: $(id -u $(whoami))" cd ~ echo $PWD ls -lsa -echo "" -echo "" -exec /usr/bin/mopidy --config /etc/mopidy.conf:/mopidy.conf +exec $@ diff --git a/localscan b/localscan index 1c1b025..9f80306 100644 --- a/localscan +++ b/localscan @@ -1,2 +1,2 @@ #! /bin/bash -/usr/bin/mopidy --config /etc/mopidy.conf:/mopidy.conf local scan \ No newline at end of file +/usr/bin/mopidy --config /etc/mopidy.conf:/mopidy.conf local scan diff --git a/mopidy.conf b/mopidy.conf index 2abb9fb..a7f4382 100644 --- a/mopidy.conf +++ b/mopidy.conf @@ -45,22 +45,3 @@ protocols = rtmps rtsp -[spotify] -enabled = false -bitrate = 320 - -[spotify_tunigo] -enabled = true -region = all - -[tunein] -enabled = false - -[soundcloud] -enabled = false - -[scrobbler] -enabled = false - -[musicbox_webclient] -#on_track_click = PLAY_NOW diff --git a/test.sh b/test.sh index cd9082c..d798fe2 100755 --- a/test.sh +++ b/test.sh @@ -2,9 +2,9 @@ docker run \ --rm \ --name mopidy \ - -e PULSE_SERVER=tcp:10.10.10.10:4713 \ - -v /home/wouter/Muziek/Spotify:/media:ro \ - -v $PWD/test-data:/var/lib/mopidy \ + -e PULSE_SERVER=tcp:10.10.10.14:4713 \ + -v /home/wouter/Muziek:/media:ro \ + -v $PWD/data:/var/lib/mopidy \ -v $PWD/accounts.conf:/mopidy.conf \ -p 6600:6600 \ -p 6680:6680 \