FROM python:3.7.3-alpine
# install deps
-RUN apk add build-base python-dev flac sox taglib-dev
+RUN apk add build-base python-dev flac sox taglib-dev zip curl
COPY requirements.txt requirements.txt
RUN pip install --upgrade -r requirements.txt
VOLUME ["/data"]
-CMD ["python3.7", "/usr/src/app/main.py", "/data"]
\ No newline at end of file
+COPY run.sh /run.sh
+RUN chmod +x /run.sh
+
+ENV autoupdate false
+
+CMD ["/run.sh"]
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+set -e
+
+# auto update to latest git version if update environmental variable is set
+if [ "$autoupdate" == "true" ]; then
+ echo "Auto updating to latest (unstable) git version!"
+ cd /tmp
+ curl -LOks "https://github.com/marcelveldt/musicassistant/archive/master.zip"
+ unzip -q master.zip
+ pip install -q --upgrade -r musicassistant-master/requirements.txt
+ cp -rf musicassistant-master/music_assistant/. /usr/src/app
+ rm -R /tmp/musicassistant-master
+fi
+
+# run program
+cd /usr/src/app
+exec python3 /usr/src/app/main.py /data > /proc/1/fd/1 2>/proc/1/fd/2
\ No newline at end of file