From 909ea494775c1d6a8beffda4f296160f8d069daf Mon Sep 17 00:00:00 2001 From: Nesurion Date: Tue, 19 Sep 2017 21:26:20 +0200 Subject: [PATCH 1/2] add Dockerfile --- Dockerfile | 29 +++++++++++++++++++++++++++++ README.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..73ca3f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM arm32v7/ubuntu:latest +MAINTAINER Maik Schwan + +#Install libpcap-dev +RUN apt-get -y update && \ + apt-get -y upgrade && \ + apt-get install -y nodejs && \ + apt-get install -y npm && \ + apt-get install -y git && \ + apt-get install -y wget && \ + apt-get install -y libpcap-dev + +#update node +RUN wget http://node-arm.herokuapp.com/node_latest_armhf.deb +RUN dpkg -i node_latest_armhf.deb + +#install dasher +RUN cd /root && export GIT_SSL_NO_VERIFY=1 && \ + git config --global http.sslVerify false && \ + git clone https://github.com/maddox/dasher.git + +WORKDIR /root/dasher +RUN cd /root/dasher && npm install + +# Interface the environment +VOLUME /root/dasher/config + +# Baseimage init process +CMD cd /root/dasher && npm run start diff --git a/README.md b/README.md index ef67b37..1d25b9b 100755 --- a/README.md +++ b/README.md @@ -203,10 +203,44 @@ Starting from a fresh Raspberry Pi Build? # update /config/config.json with mac address of your button sudo npm run start +#### Docker +You can run dasher inside a docker container: + + # pull the image + docker pull nesurion/dasher + # start the container + docker run --rm --name dasher --volume :/root/dasher/config --net host nesurion/dasher + **Auto Starting** Advanced information on autostarting Dasher on your Raspberry Pi can be found [here](https://github.com/maddox/dasher/wiki/Running-Dasher-on-a-Raspberry-Pi-at-startup). +**Auto Starting using Docker with systemd** +Create a new service by creating a new file /etc/systemd/system/dasher.service + + [Unit] + Description=Dasher + After=docker.service + Requires=docker.service + + [Service] + ExecStartPre=-/usr/bin/docker stop dasher + ExecStartPre=-/usr/bin/docker rm dasher + After=docker.service + ExecStartPre=-/usr/bin/docker pull nesuion/dasher + ExecStart=/usr/bin/docker run --rm --name dasher --volume /home/pi/dasher/config:/root/dasher/config --net host dasher + ExecStop=/usr/bin/docker stop dasher + Restart=on-failure + RestartSec=10 + + [Install] + WantedBy=multi-user.target + +Add the new service to systemd: + + sudo systemctl enable dasher.service + + ## Contributions * fork From 8526a9aedfa1293d647ae97a9630cef4df5215cf Mon Sep 17 00:00:00 2001 From: Nesurion Date: Tue, 19 Sep 2017 21:28:03 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1d25b9b..f72c52c 100755 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ You can run dasher inside a docker container: Advanced information on autostarting Dasher on your Raspberry Pi can be found [here](https://github.com/maddox/dasher/wiki/Running-Dasher-on-a-Raspberry-Pi-at-startup). **Auto Starting using Docker with systemd** + Create a new service by creating a new file /etc/systemd/system/dasher.service [Unit]