From: Marcel van der Veldt Date: Mon, 23 Feb 2026 00:36:13 +0000 (+0100) Subject: Pre-compile Python bytecode in Dockerimage for faster startup X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=e06f96a57925bdb937e2217a14a5610dd632f40a;p=music-assistant-server.git Pre-compile Python bytecode in Dockerimage for faster startup --- 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!