From 2b8ef57fc632699060615182eec3242c25daaf66 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sun, 1 Nov 2020 15:23:59 +0100 Subject: [PATCH] Update Dockerfile --- Dockerfile | 68 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0774e9b6..b2b57af2 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,60 @@ FROM python:3.8-slim # Build arguments -# ARG BUILD_ARCH="amd64" ARG MASS_VERSION=0.0.60 ARG JEMALLOC_VERSION=5.2.1 ARG S6_OVERLAY_VERSION=2.1.0.2 +ARG TARGETPLATFORM +ARG BUILDPLATFORM -RUN BUILD_ARCH="$(uname -m)" && \ - apt-get update && apt-get install -y --no-install-recommends \ - # required packages - git bash jq flac sox libsox-fmt-mp3 zip curl unzip ffmpeg libsndfile1 libtag1v5 libblas3 liblapack3 \ - # build packages - wget libtag1-dev build-essential liblapack-dev libblas-dev gfortran libatlas-base-dev && \ +RUN set -x \ + && apt-get update && apt-get install -y --no-install-recommends \ + # required packages + git bash jq tzdata curl ca-certificates flac sox libsox-fmt-mp3 zip curl unzip ffmpeg libsndfile1 libtag1v5 libblas3 liblapack3 \ + # build packages + libtag1-dev build-essential liblapack-dev libblas-dev gfortran libatlas-base-dev \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /usr/share/man/man1 \ + \ # 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} && \ + && 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 && \ - cd /tmp && \ - # 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/* + && if [ "$TARGETPLATFORM" == "linux/arm/7" ]; \ + then \ + curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-armv7.tar.gz" \ + | tar zxvf - -C /; \ + elif [ "$TARGETPLATFORM" == "linux/arm/6" ]; \ + then \ + curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-armhf.tar.gz" \ + | tar zxvf - -C /; \ + elif [ "$TARGETPLATFORM" == "linux/arm64" ]; \ + then \ + curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-aarch64.tar.gz" \ + | tar zxvf - -C /; \ + else \ + curl -L -f -s "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-amd64.tar.gz" \ + | tar zxvf - -C /; \ + fi \ + && mkdir -p /etc/fix-attrs.d \ + && mkdir -p /etc/services.d \ + \ + # install uvloop and music assistant + && cd /tmp && pip install --upgrade uvloop 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 +ENV DEBUG=false VOLUME [ "/data" ] ENTRYPOINT ["/init"] \ No newline at end of file -- 2.34.1