65 lines
2.7 KiB
Docker
65 lines
2.7 KiB
Docker
FROM python:3.13-slim
|
|
|
|
# ── System dependencies ───────────────────────────────────────────────────────
|
|
# GStreamer runtime + GObject Introspection typelibs needed at runtime.
|
|
# libgirepository + libglib dev headers + gcc needed to compile PyGObject.
|
|
# gosu: used by entrypoint to drop from root → mopidy after fixing permissions.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
# GStreamer runtime
|
|
gstreamer1.0-plugins-good \
|
|
gstreamer1.0-plugins-bad \
|
|
gstreamer1.0-plugins-ugly \
|
|
gstreamer1.0-tools \
|
|
libgstreamer1.0-0 \
|
|
libgstreamer-plugins-base1.0-0 \
|
|
# GObject Introspection typelibs (used by PyGObject at runtime)
|
|
gir1.2-gstreamer-1.0 \
|
|
gir1.2-gst-plugins-base-1.0 \
|
|
# Build deps for PyGObject (can't be removed — runtime .so links against them)
|
|
libgirepository-2.0-dev \
|
|
libglib2.0-dev \
|
|
libcairo2-dev \
|
|
gcc \
|
|
pkg-config \
|
|
# Misc
|
|
curl \
|
|
gettext-base \
|
|
gosu \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# ── Python packages ───────────────────────────────────────────────────────────
|
|
# PyGObject must be compiled first so pip can resolve mopidy's gst dependency.
|
|
# setuptools provides pkg_resources (no longer bundled in Python 3.13).
|
|
# mopidy-spotify 5.x uses the Spotify Web API (no libspotify C extension).
|
|
RUN pip install --no-cache-dir PyGObject \
|
|
&& pip install --no-cache-dir \
|
|
"setuptools<72" \
|
|
mopidy \
|
|
mopidy-local \
|
|
mopidy-mpd \
|
|
mopidy-youtube \
|
|
"mopidy-spotify>=5.0.0" \
|
|
yt-dlp
|
|
|
|
# ── Runtime user ──────────────────────────────────────────────────────────────
|
|
# Entrypoint runs as root, fixes volume ownership, then execs as mopidy via gosu.
|
|
RUN groupadd -r audio 2>/dev/null || true \
|
|
&& useradd -r -g audio -d /var/lib/mopidy -s /sbin/nologin mopidy \
|
|
&& mkdir -p /var/lib/mopidy /config \
|
|
&& chown -R mopidy:audio /var/lib/mopidy /config
|
|
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
EXPOSE 6680
|
|
|
|
HEALTHCHECK --interval=20s --timeout=5s --start-period=30s \
|
|
CMD curl -sf http://localhost:6680/mopidy/rpc \
|
|
-d '{"jsonrpc":"2.0","id":1,"method":"core.get_version"}' \
|
|
-H 'Content-Type: application/json' | grep -q '"id": 1' || exit 1
|
|
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["mopidy", "--config", "/tmp/mopidy.conf"]
|