diff --git a/.gitignore b/.gitignore index 9aa1db1..b853bc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ config.json plugins.txt tags +persist + diff --git a/Dockerfile b/Dockerfile index 0029eba..fe4283e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,8 @@ RUN apt-get install -y --no-install-recommends \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt-get update && apt-get install iputils-ping + RUN npm install -g --unsafe-perm \ homebridge \ hap-nodejs \ diff --git a/Makefile b/Makefile index 4c97e73..964da22 100644 --- a/Makefile +++ b/Makefile @@ -4,22 +4,39 @@ default: build build: docker build -t rpi-homebridge-dev . +clean: + -docker kill homebridge + -docker rm homebridge + # Target to build and run and subsequently remove image run: build docker run --net=host --rm \ - -p "localhost:51826:51826" + -p "51826:51826" \ -v "$(shell pwd)/config.json:/root/.homebridge/config.json" \ -v "$(shell pwd)/plugins.txt:/root/.homebridge/plugins.txt" \ + -v "$(shell pwd)/persist:/root/.homebridge/persist" \ rpi-homebridge-dev # Target to drop into an interractive shell shell: build docker run --net=host --rm \ - -p "localhost:51826:51826" + -p "51826:51826" \ -v "$(shell pwd)/config.json:/root/.homebridge/config.json" \ -v "$(shell pwd)/plugins.txt:/root/.homebridge/plugins.txt" \ + -v "$(shell pwd)/persist:/root/.homebridge/persist" \ -it rpi-homebridge-dev bash +# Target to buld and run in detached mode (continuously) +go: build + make clean + docker run --net=host -d \ + -p "51826:51826" \ + -v "$(shell pwd)/config.json:/root/.homebridge/config.json" \ + -v "$(shell pwd)/plugins.txt:/root/.homebridge/plugins.txt" \ + -v "$(shell pwd)/persist:/root/.homebridge/persist" \ + --name homebridge \ + rpi-homebridge-dev + # Tags dev image so it can be pushed tag: build docker tag rpi-homebridge-dev vividboarder/rpi-homebridge