From 7ab7945ae2bc18a6155a6dfaf5d6536e255e3955 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sat, 20 Apr 2019 08:50:43 +1200 Subject: [PATCH 1/3] Hotfix: adding docker config from wernight/mopidy --- Dockerfile | 65 +++++++++++++++++++++++++++++++++++++++++++++++ entrypoint.sh | 9 +++++++ mopidy.conf | 17 +++++++++++++ pulse-client.conf | 9 +++++++ 4 files changed, 100 insertions(+) create mode 100644 Dockerfile create mode 100644 entrypoint.sh create mode 100644 mopidy.conf create mode 100644 pulse-client.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..02a301c0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,65 @@ +FROM debian:stretch-slim + +RUN set -ex \ + # Official Mopidy install for Debian/Ubuntu along with some extensions + # (see https://docs.mopidy.com/en/latest/installation/debian/ ) + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl \ + dumb-init \ + gcc \ + gnupg \ + gstreamer1.0-alsa \ + gstreamer1.0-plugins-bad \ + python-crypto \ + && curl -L https://apt.mopidy.com/mopidy.gpg | apt-key add - \ + && curl -L https://apt.mopidy.com/mopidy.list -o /etc/apt/sources.list.d/mopidy.list \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + mopidy \ + mopidy-soundcloud \ + mopidy-spotify \ + && curl -L https://bootstrap.pypa.io/get-pip.py | python - \ + && pip install -U six pyasn1 requests[security] cryptography \ + && pip install \ + Mopidy-Iris \ + Mopidy-Moped \ + Mopidy-GMusic \ + Mopidy-Pandora \ + Mopidy-YouTube \ + pyopenssl \ + youtube-dl \ + && mkdir -p /var/lib/mopidy/.config \ + && ln -s /config /var/lib/mopidy/.config/mopidy \ + # Clean-up + && apt-get purge --auto-remove -y \ + curl \ + gcc \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache + +# Start helper script. +COPY entrypoint.sh /entrypoint.sh + +# Default configuration. +COPY mopidy.conf /config/mopidy.conf + +# Copy the pulse-client configuratrion. +COPY pulse-client.conf /etc/pulse/client.conf + +# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID. +ENV HOME=/var/lib/mopidy +RUN set -ex \ + && usermod -G audio,sudo mopidy \ + && chown mopidy:audio -R $HOME /entrypoint.sh \ + && chmod go+rwx -R $HOME /entrypoint.sh + +# Runs as mopidy user by default. +USER mopidy + +VOLUME ["/var/lib/mopidy/local", "/var/lib/mopidy/media"] + +EXPOSE 6600 6680 5555/udp + +ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"] +CMD ["/usr/bin/mopidy"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..9c5d6290 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$PULSE_COOKIE_DATA" ] +then + echo -ne $(echo $PULSE_COOKIE_DATA | sed -e 's/../\\x&/g') >$HOME/pulse.cookie + export PULSE_COOKIE=$HOME/pulse.cookie +fi + +exec "$@" diff --git a/mopidy.conf b/mopidy.conf new file mode 100644 index 00000000..028a6040 --- /dev/null +++ b/mopidy.conf @@ -0,0 +1,17 @@ +[core] +data_dir = /var/lib/mopidy + +[local] +media_dir = /var/lib/mopidy/media + +[audio] +output = tee name=t ! queue ! autoaudiosink t. ! queue ! udpsink host=0.0.0.0 port=5555 + +[m3u] +playlists_dir = /var/lib/mopidy/playlists + +[http] +hostname = 0.0.0.0 + +[mpd] +hostname = 0.0.0.0 diff --git a/pulse-client.conf b/pulse-client.conf new file mode 100644 index 00000000..5cc3caf9 --- /dev/null +++ b/pulse-client.conf @@ -0,0 +1,9 @@ +# Connect to the host's server using the mounted UNIX socket +default-server = unix:/run/user/105/pulse/native + +# Prevent a server running in the container +autospawn = no +daemon-binary = /bin/true + +# Prevent the use of shared memory +enable-shm = false From aed14ac27a5fb7aaf63591bf657ee252405d7d46 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sat, 20 Apr 2019 08:55:52 +1200 Subject: [PATCH 2/3] Using branches for only running CI when needed --- .circleci/config.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 18ff55dd..c880c351 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -61,29 +61,29 @@ workflows: - build: filters: branches: - only: develop + only: deploy/test - test: requires: - build filters: branches: - only: develop + only: deploy/test build_test_and_deploy: jobs: - build: filters: branches: - only: master + only: deploy/release - test: requires: - build filters: branches: - only: master + only: deploy/release - deploy: requires: - build - test filters: branches: - only: master \ No newline at end of file + only: deploy/release \ No newline at end of file From 614dc2da8c21368a1510cba4fa76b21474f45113 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Sun, 21 Apr 2019 14:05:20 +1200 Subject: [PATCH 3/3] Getting docker ready for development --- .dockerignore | 1 + Dockerfile | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 02a301c0..a2bce2f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM debian:stretch-slim +# Copy the current codebase +COPY . /iris + RUN set -ex \ # Official Mopidy install for Debian/Ubuntu along with some extensions # (see https://docs.mopidy.com/en/latest/installation/debian/ ) @@ -12,6 +15,7 @@ RUN set -ex \ gstreamer1.0-alsa \ gstreamer1.0-plugins-bad \ python-crypto \ + git \ && curl -L https://apt.mopidy.com/mopidy.gpg | apt-key add - \ && curl -L https://apt.mopidy.com/mopidy.list -o /etc/apt/sources.list.d/mopidy.list \ && apt-get update \ @@ -22,19 +26,24 @@ RUN set -ex \ && curl -L https://bootstrap.pypa.io/get-pip.py | python - \ && pip install -U six pyasn1 requests[security] cryptography \ && pip install \ - Mopidy-Iris \ Mopidy-Moped \ Mopidy-GMusic \ Mopidy-Pandora \ Mopidy-YouTube \ pyopenssl \ youtube-dl \ + # Clone Iris from repo and install in development (for hot-loading) + #&& git clone https://github.com/jaedb/Iris.git /var/lib/mopidy/iris \ + && cd /iris \ + && python setup.py develop \ + && cd / \ && mkdir -p /var/lib/mopidy/.config \ && ln -s /config /var/lib/mopidy/.config/mopidy \ # Clean-up && apt-get purge --auto-remove -y \ curl \ gcc \ + git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache