Skip to content

Commit 672e583

Browse files
committed
Change our docker image to debian
1 parent 7e71bfd commit 672e583

File tree

2 files changed

+119
-23
lines changed

2 files changed

+119
-23
lines changed

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,12 @@ RUN uv venv $VIRTUAL_ENV
1919
# comes at a cost of a slightly larger image size but is faster to start
2020
# because we do not have to install dependencies at runtime
2121
RUN uv pip install \
22-
--find-links "https://wheels.home-assistant.io/musllinux/" \
2322
-r requirements_all.txt
2423

2524
# Install Music Assistant from prebuilt wheel
2625
ARG MASS_VERSION
2726
RUN uv pip install \
2827
--no-cache \
29-
--find-links "https://wheels.home-assistant.io/musllinux/" \
3028
"music-assistant@dist/music_assistant-${MASS_VERSION}-py3-none-any.whl"
3129

3230
# we need to set (very permissive) permissions to the workdir
@@ -44,7 +42,7 @@ FROM ghcr.io/music-assistant/base:$BASE_IMAGE_VERSION
4442
ENV VIRTUAL_ENV=/app/venv
4543
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
4644

47-
# copy the already build /app dir
45+
# copy the already built /app dir
4846
COPY --from=builder /app /app
4947

5048
# the /app contents have correct permissions but for some reason /app itself does not.

Dockerfile.base

Lines changed: 118 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,138 @@
44
# This image forms the base for the final image and is not meant to be used directly
55
# NOTE that the dev add-on is also based on this base image
66

7-
FROM python:3.13-alpine3.21
7+
FROM python:3.13-slim-bookworm AS ffmpeg-builder
88

9+
# Install build dependencies for FFmpeg
10+
RUN apt-get update && apt-get install -y --no-install-recommends \
11+
build-essential \
12+
pkg-config \
13+
yasm \
14+
nasm \
15+
git \
16+
wget \
17+
ca-certificates \
18+
# Audio codec libraries
19+
libfdk-aac-dev \
20+
libmp3lame-dev \
21+
libopus-dev \
22+
libvorbis-dev \
23+
libsoxr-dev \
24+
libspeex-dev \
25+
libwavpack-dev \
26+
libflac-dev \
27+
libtwolame-dev \
28+
libvo-amrwbenc-dev \
29+
libopencore-amrnb-dev \
30+
libopencore-amrwb-dev \
31+
libshine-dev \
32+
# Additional audio processing
33+
libsamplerate0-dev \
34+
libbluray-dev \
35+
libxml2-dev \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
# Build FFmpeg 7.1.2 from source with comprehensive audio codec support
39+
# Using static linking for self-contained binaries
40+
ARG FFMPEG_VERSION=7.1.2
41+
RUN set -x \
42+
&& wget -q "https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz" -O /tmp/ffmpeg.tar.xz \
43+
&& tar -xJf /tmp/ffmpeg.tar.xz -C /tmp \
44+
&& cd /tmp/ffmpeg-${FFMPEG_VERSION} \
45+
&& ./configure \
46+
--prefix=/usr/local \
47+
--enable-gpl \
48+
--enable-nonfree \
49+
--enable-version3 \
50+
--pkg-config-flags="--static" \
51+
--extra-ldflags="-static" \
52+
--extra-libs="-lpthread -lm -lz" \
53+
# Audio codecs (comprehensive support)
54+
--enable-libfdk-aac \
55+
--enable-libmp3lame \
56+
--enable-libopus \
57+
--enable-libvorbis \
58+
--enable-libsoxr \
59+
--enable-libspeex \
60+
--enable-libwavpack \
61+
--enable-libtwolame \
62+
--enable-libshine \
63+
--enable-libopencore-amrnb \
64+
--enable-libopencore-amrwb \
65+
--enable-libvo-amrwbenc \
66+
# Audio filters and resampling
67+
--enable-libsamplerate \
68+
# Basic video support (minimal)
69+
--enable-decoder=h264 \
70+
--enable-decoder=hevc \
71+
--enable-decoder=vp8 \
72+
--enable-decoder=vp9 \
73+
# Protocols needed for streaming
74+
--enable-protocol=file \
75+
--enable-protocol=http \
76+
--enable-protocol=https \
77+
--enable-protocol=tcp \
78+
--enable-protocol=udp \
79+
--enable-protocol=rtp \
80+
# Disable unnecessary features for smaller build
81+
--disable-doc \
82+
--disable-htmlpages \
83+
--disable-manpages \
84+
--disable-podpages \
85+
--disable-txtpages \
86+
--disable-debug \
87+
--disable-shared \
88+
--enable-static \
89+
&& make -j$(nproc) \
90+
&& make install \
91+
&& strip /usr/local/bin/ffmpeg /usr/local/bin/ffprobe \
92+
&& rm -rf /tmp/ffmpeg*
93+
94+
##################################################################################################
95+
96+
FROM python:3.13-slim-bookworm
97+
98+
# Install runtime dependencies
999
RUN set -x \
10-
&& apk add --no-cache \
100+
&& apt-get update \
101+
&& apt-get install -y --no-install-recommends \
11102
ca-certificates \
12-
jemalloc \
103+
libjemalloc2 \
13104
tzdata \
14-
dnscache \
15105
# cifs utils and libnfs are needed for smb and nfs support (file provider)
16106
cifs-utils \
17-
libnfs \
18-
# openssl-dev is needed for airplay
19-
openssl-dev \
20-
# install snapcast so the snapcast provider can run the builtin snapcast server
21-
snapcast \
22-
# build tools and llvm support needed for librosa/numba/llvmlite (smartfades)
23-
build-base \
24-
llvm15-dev \
107+
libnfs13 \
108+
# openssl is needed for airplay
109+
openssl \
110+
libssl-dev \
25111
# libsndfile needed for librosa audio file support (smartfades)
26-
libsndfile-dev
112+
libsndfile1 \
113+
# snapcast server and client for snapcast provider
114+
snapserver \
115+
snapclient \
116+
&& apt-get clean \
117+
&& rm -rf /var/lib/apt/lists/*
118+
119+
# Copy statically-linked FFmpeg binaries from builder stage
120+
COPY --from=ffmpeg-builder /usr/local/bin/ffmpeg /usr/local/bin/
121+
COPY --from=ffmpeg-builder /usr/local/bin/ffprobe /usr/local/bin/
27122

28-
# Get static ffmpeg builds from https://hub.docker.com/r/mwader/static-ffmpeg/
29-
COPY --from=mwader/static-ffmpeg:7.1.1 /ffmpeg /usr/local/bin/
30-
COPY --from=mwader/static-ffmpeg:7.1.1 /ffprobe /usr/local/bin/
123+
# Verify FFmpeg installation
124+
RUN ffmpeg -version && ffprobe -version
31125

32126
# Copy widevine client files to container
33127
RUN mkdir -p /usr/local/bin/widevine_cdm
34128
COPY widevine_cdm/* /usr/local/bin/widevine_cdm/
35129

36130
# JEMalloc for more efficient memory management
37-
ENV LD_PRELOAD="/usr/lib/libjemalloc.so.2"
38-
39-
# Set LLVM config for llvmlite/numba
40-
ENV LLVM_CONFIG="/usr/bin/llvm-config-15"
131+
# Dynamically set the correct path based on architecture
132+
ARG TARGETARCH
133+
RUN set -x \
134+
&& if [ "$TARGETARCH" = "arm64" ]; then \
135+
echo "/usr/lib/aarch64-linux-gnu/libjemalloc.so.2" > /etc/ld.so.preload; \
136+
else \
137+
echo "/usr/lib/x86_64-linux-gnu/libjemalloc.so.2" > /etc/ld.so.preload; \
138+
fi
41139

42140
# we need to set (very permissive) permissions to the workdir
43141
# and /tmp to allow running the container as non-root

0 commit comments

Comments
 (0)