# syntax=docker/dockerfile:1
-ARG TARGETPLATFORM
-ARG PYTHON_VERSION="3.12"
-#####################################################################
-# #
-# Build Wheels #
-# #
-#####################################################################
-FROM python:${PYTHON_VERSION}-slim as wheels-builder
-ARG TARGETPLATFORM
+FROM python:3.12-alpine3.20
-# Install buildtime packages
-RUN set -x \
- && apt-get update \
- && apt-get install -y --no-install-recommends \
- build-essential \
- libffi-dev \
- cargo \
- git \
- curl
-
-WORKDIR /wheels
-COPY requirements_all.txt .
-
-
-# build python wheels for all dependencies
-RUN set -x \
- && pip install --upgrade pip \
- && pip install build maturin \
- && pip wheel -r requirements_all.txt
-
-
-#####################################################################
-# #
-# Final Image #
-# #
-#####################################################################
-FROM python:${PYTHON_VERSION}-slim AS final-build
-WORKDIR /app
-
-# Required to persist build arg
-ARG MASS_VERSION
-ARG TARGETPLATFORM
+ARG MASS_VERSION=2.3.0b8
RUN set -x \
- && apt-get update \
- && apt-get install -y --no-install-recommends \
+ && apk add --no-cache \
ca-certificates \
+ jemalloc \
curl \
git \
wget \
tzdata \
- libsox-fmt-all \
- libsox3 \
sox \
- cifs-utils \
- libnfs-utils \
- libjemalloc2 \
- # install snapcast server 0.27 from bookworm backports
- && sh -c 'echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list' \
- && apt-get update \
- && apt-get install -y --no-install-recommends -t bookworm-backports snapserver \
- # install ffmpeg 6 from multimedia repo
- && sh -c 'echo "Types: deb\nURIs: https://www.deb-multimedia.org\nSuites: stable\nComponents: main non-free\nSigned-By: /etc/apt/trusted.gpg.d/deb-multimedia-keyring.gpg" >> /etc/apt/sources.list.d/deb-multimedia.sources' \
- && sh -c 'echo "Package: *\nPin: origin www.deb-multimedia.org\nPin-Priority: 1" >> /etc/apt/preferences.d/99deb-multimedia' \
- && cd /tmp && curl -sLO https://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb \
- && apt install -y /tmp/deb-multimedia-keyring_2016.8.1_all.deb \
- && apt-get update \
- && apt install -y -t 'o=Unofficial Multimedia Packages' ffmpeg \
- # cleanup
- && rm -rf /tmp/* \
- && rm -rf /var/lib/apt/lists/*
+ samba \
+ # install ffmpeg from community repo
+ && apk add ffmpeg --repository=https://dl-cdn.alpinelinux.org/alpine/v3.20/community \
+ # install snapcast from community repo
+ && apk add snapcast --repository=https://dl-cdn.alpinelinux.org/alpine/v3.20/community \
+ # install libnfs from community repo
+ && apk add libnfs --repository=https://dl-cdn.alpinelinux.org/alpine/v3.20/community
# Copy widevine client files to container
RUN mkdir -p /usr/local/bin/widevine_cdm
COPY widevine_cdm/* /usr/local/bin/widevine_cdm/
-# https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#build-mounts-run---mount
-# Install all built wheels
-RUN --mount=type=bind,target=/tmp/wheels,source=/wheels,from=wheels-builder,rw \
- set -x \
- && pip install --upgrade pip \
- && pip install --no-cache-dir /tmp/wheels/*.whl
+# Upgrade pip + Install uv
+RUN pip install --upgrade pip \
+ && pip install uv==0.2.27
-# Install Music Assistant from published wheel
-RUN pip3 install \
- --no-cache-dir \
- music-assistant[server]==${MASS_VERSION} \
- && python3 -m compileall music_assistant
+# Install Music Assistant from published wheel on PyPi
+RUN uv pip install \
+ --system \
+ --no-cache \
+ --find-links "https://wheels.home-assistant.io/musllinux/" \
+ music-assistant[server]==${MASS_VERSION}
-# Enable jemalloc
-RUN \
- export LD_PRELOAD="$(find /usr/lib/ -name *libjemalloc.so.2)" \
- export MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000"
+# Configure runtime environmental variables
+RUN export LD_PRELOAD="/usr/lib/libjemalloc.so.2" \
+ && export UV_SYSTEM_PYTHON="1" \
+ && export UV_BREAK_SYSTEM_PACKAGES==1"
# Set some labels
LABEL \
io.hass.type="addon"
VOLUME [ "/data" ]
+EXPOSE 8095
ENTRYPOINT ["mass", "--config", "/data"]