diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..35c15733 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM archlinux:latest as build + +RUN pacman -Syu --noconfirm curl wget ninja pkgconf clang cmake make git \ + patch ca-certificates gd opus zlib ffmpeg flac nodejs npm lmdb +COPY . /opt/mix_build +RUN cd /opt/mix_build && make release && \ + cd /opt/mix_build && make webui && \ + mkdir -p /opt/mix/webui/public && \ + cp -a /opt/mix_build/build /opt/mix/ && \ + cp -a /opt/mix_build/webui/dist /opt/mix/webui/ + +# --- Final image --- +FROM archlinux:latest +RUN pacman -Syu --noconfirm supervisor ca-certificates \ + gd opus zlib ffmpeg flac lmdb && \ + yes | pacman -Scc + +COPY --from=build /opt/mix /opt/mix + +VOLUME /opt/mix/webui/public/avatars +VOLUME /opt/mix/webui/public/downloads +VOLUME /opt/mix/webui/database + +USER root +ENV USER=root + +ADD entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["slmix"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 00000000..4012d24d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -e + +if [ "$1" = 'slmix' ]; then + if [[ -z $TOKENHOST ]]; then + echo "No TOKENHOST env!" + exit 1 + fi + if [[ -z $TOKENDOWNLOAD ]]; then + echo "No TOKENDOWNLOAD env!" + exit 1 + fi + if [[ -z $TOKENGUEST ]]; then + echo "No TOKENGUEST env!" + exit 1 + fi + if [[ -z $TOKENAPI ]]; then + echo "No TOKENAPI env!" + exit 1 + fi + cat > /opt/mix/config <