Really a wip right now. Playing with adding shrinkwrapping so that we can get reproducible builds
This commit is contained in:
ViViDboarder 2017-08-28 18:35:05 -07:00
parent 0fbd06b497
commit 52d327c0b4
5 changed files with 44 additions and 21 deletions

View File

@ -1,7 +1,8 @@
FROM hypriot/rpi-node:8
# FROM hypriot/rpi-node:8
FROM node:8
MAINTAINER ViViDboarder <vividboarder@gmail.com>
RUN [ "cross-build-start" ]
# RUN [ "cross-build-start" ]
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
@ -16,26 +17,28 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN npm install -g --unsafe-perm \
homebridge \
hap-nodejs \
node-gyp && \
cd /usr/local/lib/node_modules/homebridge/ && \
npm install --unsafe-perm bignum && \
cd /usr/local/lib/node_modules/hap-nodejs/node_modules/mdns && \
node-gyp BUILDTYPE=Release rebuild
RUN mkdir -p /var/run/dbus/
USER root
RUN mkdir -p /root/.homebridge
RUN [ "cross-build-end" ]
RUN mkdir -p /homebridge
RUN mkdir -p /root/.homebridge
VOLUME /root/.homebridge
RUN mkdir -p /homebridge
WORKDIR /homebridge
COPY package.json /homebridge/
COPY npm-shrinkwrap.json /homebridge/
RUN npm install
# RUN [ "cross-build-end" ]
EXPOSE 5353 51826
VOLUME /root/.homebridge
WORKDIR /root/.homebridge
ADD start.sh /root/.homebridge/start.sh
COPY start.sh /homebridge/
CMD /root/.homebridge/start.sh
COPY plugins-sample.txt /homebridge/plugins.txt
CMD /homebridge/start.sh

View File

@ -7,7 +7,7 @@ build:
# 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" \
rpi-homebridge-dev
@ -15,7 +15,7 @@ run: build
# 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" \
-it rpi-homebridge-dev bash
@ -27,3 +27,12 @@ tag: build
# Pushes tagged image to docker hub
push: tag
docker push vividboarder/rpi-homebridge
clean-shrinkwrap:
echo '{}' > npm-shrinkwrap.json
update-shrinkwrap: clean-shrinkwrap build
docker run --rm \
-v "$(shell pwd)/npm-shrinkwrap.json:/homebridge/npm-shrinkwrap.json" \
rpi-homebridge-dev npm shrinkwrap
# rpi-homebridge-dev cp package-lock.json npm-shrinkwrap.json

1
npm-shrinkwrap.json generated Normal file
View File

@ -0,0 +1 @@
{}

10
package.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "docker-rpi-homebridge",
"version": "1.0.0",
"description": "Meta package for installing dependencies",
"dependencies": {
"homebridge": "0.4.27",
"hap-nodejs": "0.4.32",
"node-gyp": "3.6.2"
}
}

View File

@ -8,7 +8,7 @@ service dbus start
service avahi-daemon start
# Install desired plugins
cat /root/.homebridge/plugins.txt | xargs npm install -g --unsafe-perm
cat /homebridge/plugins.txt | xargs npm install --unsafe-perm
# Start service
homebridge
/homebridge/node_modules/.bin/homebridge