Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: add Dockerfile and entrypoint.sh #31

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
33 changes: 33 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF
mix_room MixRoom
mix_url /
mix_token_host $TOKENHOST # can start record
mix_token_download $TOKENDOWNLOAD # protected download folder
mix_token_guests $TOKENGUEST # invite url
mix_token_api $TOKENAPI # api token
#mix_path /opt/slmix/
EOF
/opt/mix/build/slmix -c /opt/mix/config "$@"
else
exec "$@"
fi