|
| 1 | +# Use Alpine edge for now as some required dependencies are only in the testing repository |
| 2 | +FROM alpine:edge |
| 3 | + |
| 4 | +# Switch to the root user while we do our changes |
| 5 | +USER root |
| 6 | +WORKDIR / |
| 7 | + |
| 8 | +# Install GStreamer and other required Debian packages |
| 9 | +RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \ |
| 10 | + && apk update \ |
| 11 | + && apk add \ |
| 12 | + dumb-init \ |
| 13 | + shadow \ |
| 14 | + sudo \ |
| 15 | + git \ |
| 16 | + py3-pip \ |
| 17 | + mopidy \ |
| 18 | + py3-mopidy-spotify |
| 19 | + |
| 20 | +# Install Node, to build Iris JS application |
| 21 | +RUN apk add nodejs npm |
| 22 | + |
| 23 | +# Upgrade Python package manager pip |
| 24 | +# https://pypi.org/project/pip/ |
| 25 | +RUN python3 -m pip install --upgrade pip |
| 26 | + |
| 27 | +# Clone Iris from the repository and install in development mode. |
| 28 | +# This allows a binding at "/iris" to map to your local folder for development, rather than |
| 29 | +# installing using pip. |
| 30 | +# Note: ADD helps prevent RUN caching issues. When HEAD changes in repo, our cache will be invalidated! |
| 31 | +ADD https://api.github.com/repos/jaedb/Iris/git/refs/heads/master version.json |
| 32 | +ENV IRIS_VERSION=develop |
| 33 | +RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/jaedb/Iris.git /iris \ |
| 34 | + && cd /iris \ |
| 35 | + && npm install \ |
| 36 | + && npm run prod \ |
| 37 | + && python3 setup.py develop \ |
| 38 | + && mkdir -p /var/lib/mopidy/.config \ |
| 39 | + && ln -s /config /var/lib/mopidy/.config/mopidy \ |
| 40 | + # Allow mopidy user to run system commands (restart, local scan, etc) |
| 41 | + && echo "mopidy ALL=NOPASSWD: /iris/mopidy_iris/system.sh" >> /etc/sudoers \ |
| 42 | + # Enable container mode (disable restart option, etc.) |
| 43 | + && echo "1" >> /IS_CONTAINER \ |
| 44 | + # Copy Version file |
| 45 | + && cp /iris/VERSION / |
| 46 | + |
| 47 | +# Install additional mopidy extensions and Python dependencies via pip |
| 48 | +COPY docker/requirements.txt . |
| 49 | +RUN python3 -m pip install -r requirements.txt |
| 50 | + |
| 51 | +# Cleanup |
| 52 | +RUN rm -rf /root/.cache \ |
| 53 | + && rm -rf /iris/node_modules |
| 54 | + |
| 55 | +# Start helper script. |
| 56 | +COPY docker/entrypoint.sh /entrypoint.sh |
| 57 | + |
| 58 | +# Copy Default configuration for mopidy |
| 59 | +COPY docker/mopidy/mopidy.example.conf /config/mopidy.conf |
| 60 | + |
| 61 | +# Copy the pulse-client configuratrion |
| 62 | +COPY docker/mopidy/pulse-client.conf /etc/pulse/client.conf |
| 63 | + |
| 64 | +# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID. |
| 65 | +# RUN useradd -ms /bin/bash mopidy |
| 66 | +ENV HOME=/var/lib/mopidy |
| 67 | +RUN set -ex \ |
| 68 | + && usermod -G audio,wheel mopidy \ |
| 69 | + && mkdir /var/lib/mopidy/local \ |
| 70 | + && chown mopidy:audio -R $HOME /entrypoint.sh /iris \ |
| 71 | + && chmod go+rwx -R $HOME /entrypoint.sh /iris |
| 72 | + |
| 73 | +# Runs as mopidy user by default. |
| 74 | +USER mopidy:audio |
| 75 | + |
| 76 | +VOLUME ["/var/lib/mopidy/local"] |
| 77 | + |
| 78 | +EXPOSE 6600 6680 1704 1705 5555/udp |
| 79 | + |
| 80 | +ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"] |
| 81 | +CMD ["mopidy"] |
0 commit comments