else
echo "channel=stable" >> $GITHUB_OUTPUT
fi
- - name: Install tomli
- run: >-
- pip install tomli tomli-w
- - 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"] = "${{ needs.build-and-publish-pypi.outputs.version }}"
+ - name: Docker meta
+ id: meta
+ uses: docker/metadata-action@v4
+ with:
+ # list of Docker images to use as base name for tags
+ images: |
+ ghcr.io/music-assistant/server
- with open("pyproject.toml", "wb") as f:
- tomli_w.dump(pyproject, f)
- # we use 3 different jobs here due to the fact that the architecture is named differently in buildx
+ # we use 3 different jobs here due so we can pass the correct BUILD_ARCH
- name: Build and Push amd64
uses: docker/build-push-action@v4.1.1
with:
ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.channel }},
ghcr.io/${{ github.repository_owner }}/server:latest
push: true
+ labels: ${{ steps.meta.outputs.labels }}
build-args: |
"MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
"BUILD_ARCH=amd64"
ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.channel }},
ghcr.io/${{ github.repository_owner }}/server:latest
push: true
+ labels: ${{ steps.meta.outputs.labels }}
build-args: |
"MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
"BUILD_ARCH=aarch64"
ghcr.io/${{ github.repository_owner }}/server:${{ steps.tags.outputs.channel }},
ghcr.io/${{ github.repository_owner }}/server:latest
push: true
+ labels: ${{ steps.meta.outputs.labels }}
build-args: |
"MASS_VERSION=${{ needs.build-and-publish-pypi.outputs.version }}"
"BUILD_ARCH=armv7"
ARG MASS_VERSION
ENV S6_SERVICES_GRACETIME=220000
ENV WHEELS_LINKS="https://wheels.home-assistant.io/musllinux/"
+ARG UVLOOP_VERSION="0.17.0"
WORKDIR /usr/src
music-assistant[server]==${MASS_VERSION} \
&& python3 -m compileall music-assistant
+# Install optional uvloop if possible (will fail on armv7)
+RUN pip3 install --no-cache-dir uvloop==${UVLOOP_VERSION}; exit 0
+
# Set some labels
LABEL \
org.opencontainers.image.title="Music Assistant" \
from music_assistant.server import MusicAssistant
from music_assistant.server.helpers.logging import activate_log_queue_handler
+try:
+ import uvloop # noqa: F401
+
+ USE_UVLOOP = True
+except ImportError:
+ USE_UVLOOP = False
+
FORMAT_DATE: Final = "%Y-%m-%d"
FORMAT_TIME: Final = "%H:%M:%S"
FORMAT_DATETIME: Final = f"{FORMAT_DATE} {FORMAT_TIME}"
run(
start_mass(),
- use_uvloop=True,
+ use_uvloop=USE_UVLOOP,
shutdown_callback=on_shutdown,
executor_workers=64,
)