Fix including the correct version number into the final docker image (#754)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 9 Jul 2023 00:02:17 +0000 (02:02 +0200)
committerGitHub <noreply@github.com>
Sun, 9 Jul 2023 00:02:17 +0000 (02:02 +0200)
.github/workflows/release.yml
Dockerfile

index cadeff1681e0e50523e4cab20ed41d37582627b9..d69b3b9a9cf4e688d6bd161f26034d702a8ed38a 100644 (file)
@@ -86,3 +86,5 @@ jobs:
             ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.channel }},
             ghcr.io/${{ github.repository_owner }}/server:latest
           push: true
+          build-args:
+            "MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
index 40478d81ed87aad5bb2c8d869b45c561321db70a..9c83520aa255ad6c210f0a089ffac0a2a68229be 100644 (file)
@@ -1,6 +1,6 @@
 # syntax=docker/dockerfile:1
 ARG TARGETPLATFORM="linux/amd64"
-ARG BUILD_VERSION=latest
+ARG MASS_VERSION="2.0.0b43"
 ARG PYTHON_VERSION="3.11"
 
 #####################################################################
@@ -28,13 +28,7 @@ COPY requirements_all.txt .
 RUN set -x \
     && pip install --upgrade pip \
     && pip install build maturin \
-    && pip wheel -r requirements_all.txt
-
-# build music assistant wheel
-COPY music_assistant music_assistant
-COPY pyproject.toml .
-COPY MANIFEST.in .
-RUN python3 -m build --wheel --outdir /wheels --skip-dependency-check
+    && pip wheel -r requirements_all.txt -w /wheels
 
 #####################################################################
 #                                                                   #
@@ -58,6 +52,7 @@ RUN set -x \
         sox \
         cifs-utils \
         libnfs-utils \
+        libjemalloc2 \
     # cleanup
     && rm -rf /tmp/* \
     && rm -rf /var/lib/apt/lists/*
@@ -68,15 +63,16 @@ RUN set -x \
 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
+    && pip install --no-cache-dir /tmp/wheels/*.whl \
+    && pip install --no-cache-dir "music-assistant[server]==${MASS_VERSION}"
 
 # Required to persist build arg
-ARG BUILD_VERSION
+ARG MASS_VERSION
 ARG TARGETPLATFORM
 
 # Set some labels for the Home Assistant add-on
 LABEL \
-    io.hass.version=${BUILD_VERSION} \
+    io.hass.version=${MASS_VERSION} \
     io.hass.name="Music Assistant" \
     io.hass.description="Music Assistant Server/Core" \
     io.hass.platform="${TARGETPLATFORM}" \
@@ -84,4 +80,5 @@ LABEL \
 
 VOLUME [ "/data" ]
 
+ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so
 ENTRYPOINT ["mass", "--config", "/data"]