Adds ability to run container in detached mode.
This change also mounts the "persist" folder so we dont lose the homebridge devices in the app on rebuilds. Ping is also installed in the container as a few homebridge plugins such as `homebridge-people` and `homebridge-lgtv2` depend on ping.
This commit is contained in:
parent
cd40c5bfcc
commit
d31e875639
|
@ -1,3 +1,5 @@
|
|||
config.json
|
||||
plugins.txt
|
||||
tags
|
||||
persist
|
||||
|
||||
|
|
|
@ -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 \
|
||||
|
|
21
Makefile
21
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
|
||||
|
|
Loading…
Reference in New Issue