Update Dockerfile
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 1 Nov 2020 14:23:59 +0000 (15:23 +0100)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 1 Nov 2020 14:23:59 +0000 (15:23 +0100)
Dockerfile

index 0774e9b6312c58fcb6a8f4f1a2a19949a0991459..b2b57af25fed2cbdc75b7d575af2a289957fc135 100755 (executable)
@@ -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