--- /dev/null
+name: Build multiarch Docker image
+
+on:
+ release:
+ types: [published, prereleased]
+
+jobs:
+ buildx:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Prepare
+ id: prep
+ run: |
+ DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/music-assistant
+ VERSION=latest
+ SHORTREF=${GITHUB_SHA::8}
+
+ # If this is git tag, use the tag name as a docker tag
+ if [[ $GITHUB_REF == refs/tags/* ]]; then
+ VERSION=${GITHUB_REF#refs/tags/v}
+ fi
+ TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
+
+ # If the VERSION looks like a version number, assume that
+ # this is the most recent version of the image and also
+ # tag it 'latest'.
+ if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
+ TAGS="$TAGS,${DOCKER_IMAGE}:latest"
+ fi
+
+ # Set output parameters.
+ echo ::set-output name=tags::${TAGS}
+ echo ::set-output name=docker_image::${DOCKER_IMAGE}
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@master
+ with:
+ platforms: all
+
+ - name: Set up Docker Buildx
+ id: buildx
+ uses: docker/setup-buildx-action@master
+
+ - name: Login to DockerHub
+ if: github.event_name != 'pull_request'
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build
+ uses: docker/build-push-action@v2
+ with:
+ builder: ${{ steps.buildx.outputs.name }}
+ context: .
+ file: ./Dockerfile
+ platforms: linux/amd64,linux/arm64,linux/ppc64le
+ push: true
+ tags: ${{ steps.prep.outputs.tags }}
\ No newline at end of file
--- /dev/null
+FROM python:slim
+
+# Build arguments
+ARG MASS_VERSION=0.0.60
+ARG JEMALLOC_VERSION=5.2.1
+ARG S6_OVERLAY_VERSION=2.1.0.2
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ # required packages
+ wget bash jq flac sox libsox-fmt-mp3 zip curl unzip ffmpeg libsndfile1 libtag1v5 libblas3 liblapack3 \
+ # build packages
+ libtag1-dev build-essential git liblapack-dev libblas-dev gfortran libatlas-base-dev && \
+ # Setup jemalloc
+ curl -L -s https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2 | tar -xjf - -C /usr/src && \
+ cd /usr/src/jemalloc-${JEMALLOC_VERSION} && \
+ ./configure && \
+ make && \
+ make install && \
+ rm -rf /usr/src/jemalloc-${JEMALLOC_VERSION} && \
+ # Setup s6 overlay
+ curl -L -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${BUILD_ARCH}.tar.gz" | tar zxvf - -C / && \
+ mkdir -p /etc/fix-attrs.d && \
+ mkdir -p /etc/services.d && \
+ # make sure uvloop is installed
+ pip install --upgrade uvloop && \
+ # install music assistant
+ cd /tmp && pip install --upgrade music-assistant==${MASS_VERSION} && \
+ # cleanup build packages
+ apt-get purge -y --auto-remove libtag1-dev build-essential liblapack-dev libblas-dev gfortran libatlas-base-dev && \
+ rm -rf /var/lib/apt/lists/*
+
+# copy rootfs
+COPY rootfs /
+
+ENV DEBUG=False
+VOLUME [ "/data" ]
+
+ENTRYPOINT ["/init"]
\ No newline at end of file
--- /dev/null
+#!/usr/bin/execlineb -S0
+# ==============================================================================
+# Take down the S6 supervision tree when MusicAssistant fails
+# ==============================================================================
+if -n { s6-test $# -ne 0 }
+if -n { s6-test ${1} -eq 256 }
+
+s6-svscanctl -t /var/run/s6/services
\ No newline at end of file
--- /dev/null
+#!/usr/bin/with-contenv sh
+# ==============================================================================
+# Run MusicAssistant
+# ==============================================================================
+
+# Enable Jemalloc
+export LD_PRELOAD="/usr/local/lib/libjemalloc.so.2"
+
+args="--config /data"
+
+if [ $DEBUG == "true" ]; then
+ args="${args} --debug"
+fi
+
+exec python -m music_assistant ${args}
\ No newline at end of file