snapcastr icon indicating copy to clipboard operation
snapcastr copied to clipboard

Basic Docker (and compose) setup

Open TheAssassin opened this issue 4 years ago • 3 comments

Closes #8.

This PR provides a basic Docker setup. The Dockerfile can be used to build a Docker image right off the git repository.

Using docker-compose you can easily build and setup a container for snapcastr. Just copy the docker-compose.yml.example to docker-compose.yml, change the environment variable SNAPCAST_HOST to the right value (most likely an IP on your LAN), and hit docker-compose up -d.

TheAssassin avatar Apr 12 '20 12:04 TheAssassin

sure, why not. but could you verify it works with the dev version? thank you very much!

xkonni avatar Apr 14 '20 16:04 xkonni

Due to the lack of setup.py in favor of this new pyproject.toml (which, to be honest, I have never used before), installing with pip install -e ... does not work. Therefore I had to remove the -e. Less efficient (due to duplicate files in the Docker container), but it works. Your dev branch requires a compiler, so I had to install gcc and a few other dependencies, too.

diff --git a/Dockerfile b/Dockerfile
index d9ad732..6567bdb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -4,7 +4,9 @@ COPY . /app/
 
 WORKDIR /app/
 
-RUN pip install -e .
+RUN apk add --no-cache gcc python3-dev musl-dev libffi-dev openssl-dev && \
+    pip install . && \
+    apk del gcc python3-dev musl-dev libffi-dev openssl-dev
 
 EXPOSE 5011
 

You can rebase the PR to point to dev instead, and I'll fix things to work there, too, if you want.

TheAssassin avatar Apr 14 '20 23:04 TheAssassin

it's also in pypi now at https://pypi.org/project/snapcastr/ . guess that makes it even easier, right?

xkonni avatar Apr 15 '20 11:04 xkonni