From efd764c2a1b7934fc205a0a4b7404dd64cdd0e9e Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 3 Nov 2020 08:58:32 +0100 Subject: [PATCH] fix alpine build --- .dockerignore | 8 ++++ Dockerfile | 45 +++++++++++--------- requirements.txt | 14 +++--- rootfs/etc/services.d/music_assistant/finish | 8 ---- rootfs/etc/services.d/music_assistant/run | 15 ------- 5 files changed, 41 insertions(+), 49 deletions(-) create mode 100644 .dockerignore delete mode 100644 rootfs/etc/services.d/music_assistant/finish delete mode 100644 rootfs/etc/services.d/music_assistant/run diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..029ac7c4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.github +.mypy_cache +.tox +.git +build +dist +venv +**/__pycache__ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index c866223e..f65e6c9b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,4 @@ -FROM python:3.8-alpine3.12 - -# Versions -ARG JEMALLOC_VERSION=5.2.1 -ARG MASS_VERSION=0.0.62 +FROM alpine:3.12 # Install packages RUN set -x \ @@ -14,18 +10,25 @@ RUN set -x \ tzdata \ ca-certificates \ curl \ - bind-tools \ flac \ sox \ + libuv \ ffmpeg \ - libsndfile \ - taglib \ - openblas \ - libgfortran \ - lapack \ + python3 \ + py3-pillow \ + py3-numpy \ + py3-scipy \ + py3-aiohttp \ + py3-jwt \ + py3-passlib \ + py3-cryptography \ + py3-zeroconf \ + py3-pytaglib \ + py3-pip \ # build packages && apk add --no-cache --virtual .build-deps \ build-base \ + python3-dev \ libsndfile-dev \ taglib-dev \ openblas-dev \ @@ -44,28 +47,32 @@ RUN set -x \ tcl-dev \ tiff-dev \ tk-dev \ - zlib-dev + zlib-dev \ + libuv-dev # setup jmalloc +ARG JEMALLOC_VERSION=5.2.1 RUN curl -L -f -s "https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2" \ - | tar -xjf - -C /usr/src \ + | tar -xjf - -C /tmp/src \ && cd /usr/src/jemalloc-${JEMALLOC_VERSION} \ && ./configure \ && make \ - && make install \ - && rm -rf /usr/src/jemalloc-${JEMALLOC_VERSION} \ - # change workdir back to /tmp - && cd /tmp + && make install # install uvloop and music assistant -RUN pip install --upgrade uvloop music-assistant==${MASS_VERSION} +WORKDIR /usr/src/ +COPY . . +RUN pip install --upgrade uvloop \ + && python3 setup.py install # cleanup build files RUN apk del .build-deps \ && rm -rf /usr/src/* ENV DEBUG=false +EXPOSE 8095/tcp + VOLUME [ "/data" ] ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so -ENTRYPOINT ["python", "-m", "music_assistant", "--config", "/data"] \ No newline at end of file +ENTRYPOINT ["python3", "-m", "music_assistant", "--config", "/data"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index a3e4e74c..8b60d598 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,23 @@ argparse==1.4.0 -aiohttp[speedups]==3.7.2 +aiohttp[speedups]~=3.7.2 pychromecast==7.5.1 asyncio-throttle==1.0.1 aiofile==3.1.0 aiosqlite==0.16.0 -pytaglib==1.4.6 +pytaglib~=1.4.6 python-slugify==4.0.1 memory-tempfile==2.2.3 pyloudnorm==0.1.0 SoundFile==0.10.3.post1 aiorun==2020.11.1 soco==0.20 -pillow==8.0.1 +pillow<=8.0.1 aiohttp_cors==0.7.0 unidecode==1.1.1 -PyJWT==1.7.1 +PyJWT~=1.7.1 aiohttp_jwt==0.6.1 -zeroconf==0.28.6 -passlib==1.7.4 -cryptography==3.2 +zeroconf>=0.28.5 +passlib~=1.7.4 +cryptography>=2.9.2 ujson==4.0.1 mashumaro==1.13 diff --git a/rootfs/etc/services.d/music_assistant/finish b/rootfs/etc/services.d/music_assistant/finish deleted file mode 100644 index 282679ee..00000000 --- a/rootfs/etc/services.d/music_assistant/finish +++ /dev/null @@ -1,8 +0,0 @@ -#!/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 diff --git a/rootfs/etc/services.d/music_assistant/run b/rootfs/etc/services.d/music_assistant/run deleted file mode 100644 index f933252b..00000000 --- a/rootfs/etc/services.d/music_assistant/run +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/with-contenv bash -# ============================================================================== -# 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 -- 2.34.1