2023-01-03 18:59:37 +01:00
|
|
|
# --- Build Node ---
|
2024-10-29 06:20:59 +13:00
|
|
|
FROM docker.io/rust:slim-bookworm AS Builder
|
2022-12-11 20:41:45 +13:00
|
|
|
LABEL org.opencontainers.image.authors="https://github.com/seppi91"
|
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
|
ARG TARGETARCH
|
|
|
|
|
ARG TARGETVARIANT
|
2023-01-03 18:59:37 +01:00
|
|
|
|
|
|
|
|
# Print Info about current build Target
|
2022-12-11 20:41:45 +13:00
|
|
|
RUN printf "I'm building for TARGETPLATFORM=${TARGETPLATFORM}" \
|
|
|
|
|
&& printf ", TARGETARCH=${TARGETARCH}" \
|
|
|
|
|
&& printf ", TARGETVARIANT=${TARGETVARIANT} \n" \
|
|
|
|
|
&& printf "With uname -s : " && uname -s \
|
|
|
|
|
&& printf "and uname -m : " && uname -mm
|
2020-01-22 21:55:22 +13:00
|
|
|
|
2019-12-24 11:58:09 +13:00
|
|
|
# Switch to the root user while we do our changes
|
|
|
|
|
USER root
|
|
|
|
|
|
2022-12-11 20:41:45 +13:00
|
|
|
# Install all libraries and needs
|
2023-01-03 18:59:37 +01:00
|
|
|
RUN apt update \
|
|
|
|
|
&& apt install -yq --no-install-recommends \
|
|
|
|
|
git \
|
|
|
|
|
patch \
|
|
|
|
|
libgstreamer-plugins-base1.0-dev \
|
|
|
|
|
libgstreamer1.0-dev \
|
|
|
|
|
libcsound64-dev \
|
2024-03-18 20:11:57 +13:00
|
|
|
libclang-14-dev \
|
2023-01-03 18:59:37 +01:00
|
|
|
libpango1.0-dev \
|
|
|
|
|
libdav1d-dev \
|
2024-03-18 20:11:57 +13:00
|
|
|
libgtk-4-dev \
|
2023-01-03 18:59:37 +01:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
WORKDIR /usr/src/gst-plugins-rs
|
|
|
|
|
|
|
|
|
|
# Clone source of gst-plugins-rs to workdir
|
2024-03-18 20:11:57 +13:00
|
|
|
ARG GST_PLUGINS_RS_TAG=0.12.2
|
2023-01-03 18:59:37 +01:00
|
|
|
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 ./
|
|
|
|
|
|
|
|
|
|
# Build GStreamer plugins written in Rust (optional with --no-default-features)
|
|
|
|
|
ENV DEST_DIR /target/gst-plugins-rs
|
|
|
|
|
ENV CARGO_PROFILE_RELEASE_DEBUG false
|
|
|
|
|
RUN export CSOUND_LIB_DIR="/usr/lib/$(uname -m)-linux-gnu" \
|
|
|
|
|
&& export PLUGINS_DIR=$(pkg-config --variable=pluginsdir gstreamer-1.0) \
|
|
|
|
|
&& export SO_SUFFIX=so \
|
|
|
|
|
&& cargo build --release --no-default-features \
|
|
|
|
|
# List of packages to build
|
|
|
|
|
--package gst-plugin-spotify \
|
|
|
|
|
# Use install command to create directory (-d), copy and print filenames (-v), and set attributes/permissions (-m)
|
|
|
|
|
&& install -v -d ${DEST_DIR}/${PLUGINS_DIR} \
|
|
|
|
|
&& install -v -m 755 target/release/*.${SO_SUFFIX} ${DEST_DIR}/${PLUGINS_DIR}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# --- Release Node ---
|
2024-10-29 06:20:59 +13:00
|
|
|
FROM docker.io/debian:bookworm-slim as Release
|
2023-01-03 18:59:37 +01:00
|
|
|
|
|
|
|
|
# Switch to the root user while we do our changes
|
|
|
|
|
USER root
|
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
|
|
# Install GStreamer and other required Debian packages
|
2019-12-24 11:58:09 +13:00
|
|
|
RUN apt-get update \
|
2022-12-11 20:41:45 +13:00
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
|
sudo \
|
|
|
|
|
build-essential \
|
|
|
|
|
curl \
|
|
|
|
|
git \
|
2021-03-27 17:47:55 +01:00
|
|
|
wget \
|
|
|
|
|
gnupg2 \
|
2019-12-24 11:58:09 +13:00
|
|
|
dumb-init \
|
|
|
|
|
graphviz-dev \
|
2022-12-11 20:41:45 +13:00
|
|
|
pulseaudio \
|
2019-12-24 11:58:09 +13:00
|
|
|
libasound2-dev \
|
2020-12-05 21:40:34 +13:00
|
|
|
libdbus-glib-1-dev \
|
|
|
|
|
libgirepository1.0-dev \
|
2022-12-11 20:41:45 +13:00
|
|
|
# Install Python
|
|
|
|
|
python3-dev \
|
|
|
|
|
python3-gst-1.0 \
|
|
|
|
|
python3-setuptools \
|
|
|
|
|
python3-pip \
|
2024-03-18 20:11:57 +13:00
|
|
|
python3-venv \
|
2022-12-11 20:41:45 +13:00
|
|
|
# GStreamer (Plugins)
|
|
|
|
|
gstreamer1.0-plugins-good \
|
2023-01-03 18:59:37 +01:00
|
|
|
gstreamer1.0-plugins-bad \
|
2022-12-11 20:41:45 +13:00
|
|
|
gstreamer1.0-plugins-ugly \
|
|
|
|
|
gstreamer1.0-libav \
|
|
|
|
|
gstreamer1.0-pulseaudio \
|
2023-01-03 18:59:37 +01:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2024-03-18 20:11:57 +13:00
|
|
|
# Allow pip to install over system packages
|
|
|
|
|
ENV PIP_BREAK_SYSTEM_PACKAGES 1
|
|
|
|
|
|
2023-01-03 18:59:37 +01:00
|
|
|
# Copy builded target data from Builder DEST_DIR to root
|
|
|
|
|
# Note: target directory tree links directly to $GST_PLUGIN_PATH
|
|
|
|
|
COPY --from=Builder /target/gst-plugins-rs/ /
|
2022-12-11 20:41:45 +13:00
|
|
|
|
2023-01-02 21:43:45 +13:00
|
|
|
# Install Node, to build Iris JS application
|
2024-03-18 20:11:57 +13:00
|
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
|
2023-01-02 21:43:45 +13:00
|
|
|
apt-get install -y nodejs
|
|
|
|
|
|
2023-01-03 18:59:37 +01:00
|
|
|
# Install mopidy and (optional) DLNA-server dleyna from apt.mopidy.com
|
2022-12-11 20:41:45 +13:00
|
|
|
# see https://docs.mopidy.com/en/latest/installation/debian/
|
2023-04-03 10:50:02 +02:00
|
|
|
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 \
|
2022-12-11 20:41:45 +13:00
|
|
|
&& apt-get update \
|
2024-03-18 20:11:57 +13:00
|
|
|
&& apt-get install -y mopidy \
|
2022-12-11 20:41:45 +13:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
2023-01-03 18:59:37 +01:00
|
|
|
# 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.
|
2022-12-11 20:41:45 +13:00
|
|
|
# Note: ADD helps prevent RUN caching issues. When HEAD changes in repo, our cache will be invalidated!
|
2021-10-24 11:54:43 +13:00
|
|
|
ADD https://api.github.com/repos/jaedb/Iris/git/refs/heads/master version.json
|
2023-01-03 18:59:37 +01:00
|
|
|
ENV IRIS_VERSION=develop
|
|
|
|
|
RUN git clone --depth 1 --single-branch -b ${IRIS_VERSION} https://github.com/jaedb/Iris.git /iris \
|
2020-04-14 08:53:40 +12:00
|
|
|
&& cd /iris \
|
2023-01-03 08:01:14 +13:00
|
|
|
&& npm install \
|
2023-01-02 21:43:45 +13:00
|
|
|
&& npm run prod \
|
2021-03-27 17:47:55 +01:00
|
|
|
&& python3 setup.py develop \
|
2020-01-22 21:55:22 +13:00
|
|
|
&& 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)
|
2023-01-03 18:59:37 +01:00
|
|
|
&& 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 /
|
2019-12-24 13:52:50 +13:00
|
|
|
|
2024-03-18 20:11:57 +13:00
|
|
|
# Install Mopidy Spotify
|
|
|
|
|
ARG MOPIDY_SPOTIFY_TAG=v5.0.0a1
|
2024-03-18 20:26:53 +13:00
|
|
|
RUN git clone --depth 1 --single-branch -b ${MOPIDY_SPOTIFY_TAG} \
|
2024-03-18 20:29:01 +13:00
|
|
|
&& https://github.com/mopidy/mopidy-spotify.git mopidy-spotify \
|
2022-12-11 20:41:45 +13:00
|
|
|
&& cd mopidy-spotify \
|
|
|
|
|
&& python3 setup.py install \
|
|
|
|
|
&& cd .. \
|
|
|
|
|
&& rm -rf mopidy-spotify
|
2019-04-20 08:50:43 +12:00
|
|
|
|
2023-01-03 18:59:37 +01:00
|
|
|
# Install additional mopidy extensions and Python dependencies via pip
|
2023-01-05 21:35:37 +13:00
|
|
|
COPY docker/requirements.txt .
|
2022-12-11 20:41:45 +13:00
|
|
|
RUN python3 -m pip install -r requirements.txt
|
2019-04-20 08:50:43 +12:00
|
|
|
|
2022-12-11 20:41:45 +13:00
|
|
|
# Cleanup
|
2023-01-03 08:01:14 +13:00
|
|
|
RUN apt-get clean all \
|
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
|
&& rm -rf /root/.cache \
|
|
|
|
|
&& rm -rf /iris/node_modules
|
2019-04-20 08:50:43 +12:00
|
|
|
|
2023-01-03 18:59:37 +01:00
|
|
|
# Start helper script.
|
2022-12-11 20:41:45 +13:00
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
2019-12-24 11:58:09 +13:00
|
|
|
|
2023-01-03 18:59:37 +01:00
|
|
|
# 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
|
|
|
|
|
|
2019-04-20 08:50:43 +12:00
|
|
|
# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID.
|
2022-01-29 22:42:20 +13:00
|
|
|
# RUN useradd -ms /bin/bash mopidy
|
2020-01-22 21:55:22 +13:00
|
|
|
ENV HOME=/var/lib/mopidy
|
|
|
|
|
RUN set -ex \
|
2022-12-11 20:41:45 +13:00
|
|
|
&& usermod -G audio,sudo,pulse-access mopidy \
|
2020-04-14 08:53:40 +12:00
|
|
|
&& mkdir /var/lib/mopidy/local \
|
2023-01-03 18:59:37 +01:00
|
|
|
&& chown mopidy:audio -R $HOME /entrypoint.sh /iris \
|
|
|
|
|
&& chmod go+rwx -R $HOME /entrypoint.sh /iris
|
2020-01-22 21:55:22 +13:00
|
|
|
|
|
|
|
|
# Runs as mopidy user by default.
|
|
|
|
|
USER mopidy:audio
|
|
|
|
|
|
2020-04-14 08:53:40 +12:00
|
|
|
VOLUME ["/var/lib/mopidy/local"]
|
2019-04-20 08:50:43 +12:00
|
|
|
|
2020-01-22 21:55:22 +13:00
|
|
|
EXPOSE 6600 6680 1704 1705 5555/udp
|
2019-04-20 08:50:43 +12:00
|
|
|
|
2020-01-22 21:55:22 +13:00
|
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"]
|
2021-03-27 17:47:55 +01:00
|
|
|
CMD ["mopidy"]
|