diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e3fe44a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +Library/ +.git/ +testenv/ +linuxenv/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e43be39 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:focal + +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y ffmpeg + +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip libxml2-dev libxslt1-dev sudo sqlite3 && \ + useradd --create-home --uid 1000 app + +ADD requirements.txt /tmp/requirements.txt + +RUN pip3 install -r /tmp/requirements.txt + +ADD . /tmp/code + +RUN cd /tmp/code && \ + python3 setup.py install && \ + mv start.sh / && \ + chmod +x /start.sh + +ENTRYPOINT ["/start.sh", "--database-path", "/db/pysonic.sqlite", "--dirs", "/library"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f41f2f7 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +BUILDARGS := +IMAGE := dockermirror:5000/dpedu/pysonic + +.PHONY: image +image: + docker build -t $(IMAGE) $(BUILDARGS) . + +.PHONY: push +push: image + docker push $(IMAGE) + + + + + + +.PHONY: run-local +run-local: + pysonicd -d ./Library/ -u foo:bar -s ./db.sqlite --debug diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ec65f6 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +pysonic +======= + +subsonic api drop-in replacement + +running docker +-------------- + +* `make image` + +Notes: + +* mount the sqlite database in /db/, it will be chowned automatically +* mount library in /library/ diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..c484eb6 --- /dev/null +++ b/start.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +chown -R app:app /db/ + +exec sudo --preserve-env -Hu app pysonicd $@