diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d1a2a511..924f612ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: name: ${{ matrix.name }} runs-on: ubuntu-20.04 - container: ghcr.io/mopidy/ci:latest + container: ghcr.io/mopidy/ci:7 steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index c883991f8..b4fa4c5e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,13 +32,11 @@ RUN apt update \ WORKDIR /usr/src/gst-plugins-rs # Clone source of gst-plugins-rs to workdir -ARG GST_PLUGINS_RS_TAG=main +ARG GST_PLUGINS_RS_TAG=0.10.5 RUN git clone -c advice.detachedHead=false \ --single-branch --depth 1 \ --branch ${GST_PLUGINS_RS_TAG} \ https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git ./ -# EXPERIMENTAL: For gstreamer-spotify set upgraded version number of dependency librespot to 0.4.2 -RUN sed -i 's/librespot = { version = "0.4", default-features = false }/librespot = { version = "0.4.2", default-features = false }/g' audio/spotify/Cargo.toml # Build GStreamer plugins written in Rust (optional with --no-default-features) ENV DEST_DIR /target/gst-plugins-rs @@ -99,9 +97,9 @@ RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \ # Install mopidy and (optional) DLNA-server dleyna from apt.mopidy.com # see https://docs.mopidy.com/en/latest/installation/debian/ -RUN mkdir -p /usr/local/share/keyrings \ - && wget -q -O /usr/local/share/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \ - && wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list \ +RUN mkdir -p /etc/apt/keyrings \ + && wget -q -O /etc/apt/keyrings/mopidy-archive-keyring.gpg https://apt.mopidy.com/mopidy.gpg \ + && wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/bullseye.list \ && apt-get update \ && apt-get install -y \ mopidy \ @@ -133,7 +131,7 @@ RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/ja # Install mopidy-spotify-gstspotify (Hack, not released yet!) # (https://github.com/kingosticks/mopidy-spotify/tree/gstspotifysrc-hack) -RUN git clone --depth 1 -b gstspotifysrc-hack https://github.com/kingosticks/mopidy-spotify.git mopidy-spotify \ +RUN git clone --depth 1 https://github.com/mopidy/mopidy-spotify.git mopidy-spotify \ && cd mopidy-spotify \ && python3 setup.py install \ && cd .. \ diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 000000000..bc1db6ddc --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,81 @@ +# Use Alpine edge for now as some required dependencies are only in the testing repository +FROM alpine:edge + +# Switch to the root user while we do our changes +USER root +WORKDIR / + +# Install GStreamer and other required Debian packages +RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ + && apk update \ + && apk add \ + dumb-init \ + shadow \ + sudo \ + git \ + py3-pip \ + mopidy \ + py3-mopidy-spotify + +# Install Node, to build Iris JS application +RUN apk add nodejs npm + +# Upgrade Python package manager pip +# https://pypi.org/project/pip/ +RUN python3 -m pip install --upgrade pip + +# Clone Iris from the repository and install in development mode. +# This allows a binding at "/iris" to map to your local folder for development, rather than +# installing using pip. +# Note: ADD helps prevent RUN caching issues. When HEAD changes in repo, our cache will be invalidated! +ADD https://api.github.com/repos/jaedb/Iris/git/refs/heads/master version.json +ENV IRIS_VERSION=develop +RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/jaedb/Iris.git /iris \ + && cd /iris \ + && npm install \ + && npm run prod \ + && python3 setup.py develop \ + && mkdir -p /var/lib/mopidy/.config \ + && ln -s /config /var/lib/mopidy/.config/mopidy \ + # Allow mopidy user to run system commands (restart, local scan, etc) + && echo "mopidy ALL=NOPASSWD: /iris/mopidy_iris/system.sh" >> /etc/sudoers \ + # Enable container mode (disable restart option, etc.) + && echo "1" >> /IS_CONTAINER \ + # Copy Version file + && cp /iris/VERSION / + +# Install additional mopidy extensions and Python dependencies via pip +COPY docker/requirements.txt . +RUN python3 -m pip install -r requirements.txt + +# Cleanup +RUN rm -rf /root/.cache \ + && rm -rf /iris/node_modules + +# Start helper script. +COPY docker/entrypoint.sh /entrypoint.sh + +# Copy Default configuration for mopidy +COPY docker/mopidy/mopidy.example.conf /config/mopidy.conf + +# Copy the pulse-client configuratrion +COPY docker/mopidy/pulse-client.conf /etc/pulse/client.conf + +# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID. +# RUN useradd -ms /bin/bash mopidy +ENV HOME=/var/lib/mopidy +RUN set -ex \ + && usermod -G audio,wheel mopidy \ + && mkdir /var/lib/mopidy/local \ + && chown mopidy:audio -R $HOME /entrypoint.sh /iris \ + && chmod go+rwx -R $HOME /entrypoint.sh /iris + +# Runs as mopidy user by default. +USER mopidy:audio + +VOLUME ["/var/lib/mopidy/local"] + +EXPOSE 6600 6680 1704 1705 5555/udp + +ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"] +CMD ["mopidy"] diff --git a/IRIS_VERSION b/IRIS_VERSION index 5e64c6ce3..52de97a7f 100755 --- a/IRIS_VERSION +++ b/IRIS_VERSION @@ -1 +1 @@ -3.66.1 +3.67.0 diff --git a/MANIFEST.in b/MANIFEST.in index 0957ae8a7..5d1464794 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,6 +7,7 @@ include mopidy_iris/ext.conf include mopidy_iris/system.sh include IRIS_VERSION include Dockerfile +include Dockerfile.alpine include pyproject.toml include screenshot.jpg include tox.ini diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index aec103625..6c3b475e0 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,14 +1,14 @@ -#!/bin/bash +#!/bin/sh 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 + printf '%s' "$(echo "$PULSE_COOKIE_DATA" | sed -e 's/../\\x&/g')" >"$HOME"/pulse.cookie + export PULSE_COOKIE="$HOME"/pulse.cookie fi if [ ${PIP_PACKAGES:+x} ]; then echo "-- INSTALLING PIP PACKAGES $PIP_PACKAGES --" - python3 -m pip install --no-cache $PIP_PACKAGES + python3 -m pip install --no-cache --upgrade "$PIP_PACKAGES" fi exec "$@" diff --git a/package.json b/package.json index 19cecac92..48da1fe14 100644 --- a/package.json +++ b/package.json @@ -94,7 +94,7 @@ }, "scripts": { "test": "jest", - "tox": "docker exec -it -u root iris_mopidy_1 bash -c \"cd /iris && tox\"", + "tox": "docker exec -it -u root mopidy bash -c \"cd /iris && tox\"", "start": "NODE_ENV=development WEBPACK_DEV_SERVER=1 webpack-dev-server", "lint": "eslint src", "lint:fix": "eslint src --fix", diff --git a/src/index.html b/src/index.html index 6ca6d9164..1ed47b120 100755 --- a/src/index.html +++ b/src/index.html @@ -116,7 +116,7 @@