-FROM python:3.8-slim
+FROM python:3.8-alpine3.12
-# Build arguments
-ARG MASS_VERSION=0.0.60
+# Versions
ARG JEMALLOC_VERSION=5.2.1
+ARG MASS_VERSION=0.0.60
-ARG TARGETPLATFORM
-ARG BUILDPLATFORM
-
-WORKDIR /usr/src
+# Base system
+WORKDIR /tmp
+# Install packages
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 \
+ && apk update \
+ && echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
+ # default packages
+ && apk add --no-cache \
+ tzdata \
+ ca-certificates \
+ curl \
+ bind-tools \
+ flac \
+ sox \
+ ffmpeg \
+ libsndfile \
+ taglib \
+ openblas \
+ libgfortran \
+ lapack \
+ # build packages
+ && apk add --no-cache --virtual .build-deps \
+ build-base \
+ libsndfile-dev \
+ taglib-dev \
+ openblas-dev \
+ lapack-dev \
+ libffi-dev \
+ gcc \
+ gfortran \
+ freetype-dev \
+ libpng-dev \
+ libressl-dev \
+ fribidi-dev \
+ harfbuzz-dev \
+ jpeg-dev \
+ lcms2-dev \
+ openjpeg-dev \
+ tcl-dev \
+ tiff-dev \
+ tk-dev \
+ zlib-dev
+
+# setup jmalloc
+RUN curl -L -f -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} \
- \
- && cd /tmp \
- \
- # rustup requirement for maturin/orjson
- # && pip install maturin \
- # && curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2020-10-24 --profile minimal -y \
- # && source $HOME/.cargo/env \
- # install uvloop and music assistant
- && 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/*
+ # change workdir back to /tmp
+ && cd /tmp
+
+# build orjson
+ENV RUSTFLAGS "-C target-feature=-crt-static"
+RUN wget -O rustup.sh https://sh.rustup.rs \
+ && sh rustup.sh -y \
+ && cp $HOME/.cargo/bin/* /usr/local/bin \
+ && rustup install nightly \
+ && rustup default nightly \
+ && pip install orjson \
+ && sh rustup.sh --uninstall -y \
+ && rm rustup.sh
+
+# install uvloop and music assistant
+RUN pip install --upgrade uvloop music-assistant==${MASS_VERSION}
+# cleanup build files
+RUN apk del .build-deps \
+ && rm -rf /usr/src/*
+COPY run.sh /
+RUN chmod +x /run.sh
+WORKDIR /
ENV DEBUG=false
VOLUME [ "/data" ]