From e06f96a57925bdb937e2217a14a5610dd632f40a Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 23 Feb 2026 01:36:13 +0100 Subject: [PATCH] Pre-compile Python bytecode in Dockerimage for faster startup --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 913c5083..f215d796 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,9 @@ RUN uv pip install \ --no-cache \ "music-assistant@dist/music_assistant-${MASS_VERSION}-py3-none-any.whl" +# Pre-compile Python bytecode for faster startup +RUN $VIRTUAL_ENV/bin/python -m compileall -q $VIRTUAL_ENV/lib/python*/site-packages/music_assistant + # we need to set (very permissive) permissions to the workdir # and /tmp to allow running the container as non-root # IMPORTANT: chmod here, NOT on the final image, to avoid creating extra layers and increase size! -- 2.34.1