Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
oznu committed Mar 12, 2017
0 parents commit c8a5aa9
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
test-volume
18 changes: 18 additions & 0 deletions Dockerfile
@@ -0,0 +1,18 @@
FROM node:7.7.2-alpine

RUN apk add --no-cache git python make g++ libffi-dev openssl-dev avahi-compat-libdns_sd avahi-dev openrc dbus

RUN npm install --silent -g homebridge

RUN mkdir /homebridge && mkdir -p /home/root/homebridge
WORKDIR /homebridge

COPY default.package.json /home/root/homebridge
COPY default.config.json /home/root/homebridge
COPY entrypoint.sh /sbin/entrypoint.sh

VOLUME /homebridge

ENTRYPOINT ["/sbin/entrypoint.sh"]

CMD ["homebridge", "-U", "/homebridge", "-P", "/homebridge/node_modules"]
35 changes: 35 additions & 0 deletions README.md
@@ -0,0 +1,35 @@
# Docker Homebridge

This a lightweight alpine-based docker image allows you to run [Nfarina's](https://github.com/nfarina) [Homebridge](https://github.com/nfarina/homebridge) on your home network that emulates the iOS HomeKit API.

## Compatibility

Homebridge requires full access to your local network to function correctly which can be achieved using the ```--net=host``` flag.
Currently this will not work when using [Docker for Mac](https://docs.docker.com/docker-for-mac/) due to [this issue](https://github.com/docker/for-mac/issues/68).

## Usage

Quick Setup:

```shell
docker run --net=host -v </path/to/config>:/homebridge oznu/homebridge
```

## Config

The Homebridge config file is located at **/</path/to/config>/config.json***
This file will be created the first time you run the container with a sample [FakeBulb](https://www.npmjs.com/package/homebridge-fakebulb) accessory.

## Plugins

Plugins should be defined in the **/</path/to/config>/package.json** file in the standard NPM format.
This file will be created the first time you run the container with the [FakeBulb](https://www.npmjs.com/package/homebridge-fakebulb) module.

Any plugins added to the **package.json** will be installed each time the container is restarted.
Plugins can be uninstalled by removing the entry from the **package.json** and restarting the container.

## Troubleshooting

### 1. Verify your config.json and package.json syntax

Many issues appear because of invalid JSON. A good way to verify your config is to use the jsonlint.com validator.
20 changes: 20 additions & 0 deletions default.config.json
@@ -0,0 +1,20 @@
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},

"description": "This is an example configuration file. You can use this as a template for creating your own configuration file containing devices you actually own.",

"accessories": [
{
"accessory": "FakeBulb",
"name": "Fake Light"
}
],

"platforms": [
]
}
5 changes: 5 additions & 0 deletions default.package.json
@@ -0,0 +1,5 @@
{
"dependencies": {
"homebridge-fakebulb": "^0.0.3"
}
}
14 changes: 14 additions & 0 deletions entrypoint.sh
@@ -0,0 +1,14 @@
#!/bin/sh

dbus-daemon --system
avahi-daemon -D

[ -f /homebridge/package.json ] || cp /home/root/homebridge/default.package.json /homebridge/package.json
[ -f /homebridge/config.json ] || cp /home/root/homebridge/default.config.json /homebridge/config.json

echo "Removing old plugins..."
npm prune
echo "Installing plugins..."
npm install --silent

exec "$@"

0 comments on commit c8a5aa9

Please sign in to comment.