try to fix the docker build
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 9 Jul 2023 01:08:31 +0000 (03:08 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 9 Jul 2023 01:08:31 +0000 (03:08 +0200)
.github/workflows/release.yml
Dockerfile

index d69b3b9a9cf4e688d6bd161f26034d702a8ed38a..cb80fd515e0a8cfd089123b43bf965d5a31807f8 100644 (file)
@@ -73,6 +73,19 @@ jobs:
           else
             echo "channel=stable" >> $GITHUB_OUTPUT
           fi
+      - name: Set Python project version from tag
+        shell: python
+        run: |-
+          import tomli
+          import tomli_w
+
+          with open("pyproject.toml", "rb") as f:
+            pyproject = tomli.load(f)
+
+          pyproject["project"]["version"] = "${{ steps.vars.outputs.tag }}"
+
+          with open("pyproject.toml", "wb") as f:
+            tomli_w.dump(pyproject, f)
       - name: Build and Push
         uses: docker/build-push-action@v4.1.1
         with:
index 9c83520aa255ad6c210f0a089ffac0a2a68229be..651a8ba3d2411b6383a1c175ff35f59b46b5d212 100644 (file)
@@ -1,6 +1,6 @@
 # syntax=docker/dockerfile:1
 ARG TARGETPLATFORM="linux/amd64"
-ARG MASS_VERSION="2.0.0b43"
+ARG BUILD_VERSION=latest
 ARG PYTHON_VERSION="3.11"
 
 #####################################################################
@@ -28,7 +28,13 @@ COPY requirements_all.txt .
 RUN set -x \
     && pip install --upgrade pip \
     && pip install build maturin \
-    && pip wheel -r requirements_all.txt -w /wheels
+    && 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
 
 #####################################################################
 #                                                                   #
@@ -63,16 +69,15 @@ 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 "music-assistant[server]==${MASS_VERSION}"
+    && pip install --no-cache-dir /tmp/wheels/*.whl
 
 # Required to persist build arg
-ARG MASS_VERSION
+ARG BUILD_VERSION
 ARG TARGETPLATFORM
 
 # Set some labels for the Home Assistant add-on
 LABEL \
-    io.hass.version=${MASS_VERSION} \
+    io.hass.version=${BUILD_VERSION} \
     io.hass.name="Music Assistant" \
     io.hass.description="Music Assistant Server/Core" \
     io.hass.platform="${TARGETPLATFORM}" \