Skip to content

Commit 194bc23

Browse files
committed
Add Dockerfile and update readme. #55
1 parent 180fb7e commit 194bc23

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.tox
2+
.eggs
3+
.ignore
4+
.pytest_cache
5+
.vscode
6+
dist

Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from python:3.6-stretch
2+
3+
ENV LANG C.UTF-8
4+
ENV LC_ALL C.UTF-8
5+
6+
RUN pip install --no-cache-dir pipenv
7+
8+
RUN useradd -m -s /bin/bash mqttgpio
9+
USER mqttgpio
10+
WORKDIR /home/mqttgpio
11+
12+
COPY Pipfile* ./
13+
RUN pipenv install --three --deploy
14+
15+
COPY pi_mqtt_gpio pi_mqtt_gpio
16+
17+
CMD [ "pipenv", "run", "python", "-m", "pi_mqtt_gpio.server", "/config.yml" ]

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,32 @@ sudo supervisorctl status
254254
```
255255

256256
Check the [supervisor docs](http://supervisord.org/running.html#supervisorctl-command-line-options) for more `supervisorctl` commands.
257+
258+
Docker
259+
------
260+
261+
You may also run this software using Docker. You must create your config file as above, then run the docker image:
262+
263+
```
264+
docker run -ti --rm -v /path/to/your/config.yml:/config.yml flyte/mqtt-gpio
265+
```
266+
267+
Or to run in the background:
268+
269+
```
270+
docker run -d --name mqtt-gpio -v /path/to/your/config.yml:/config.yml flyte/mqtt-gpio
271+
```
272+
273+
You'll most likely want to use some hardware devices in your config, since that's what this project is all about. For example, if you wish to use the i2c bus, pass it through with a `--device` parameter:
274+
275+
```
276+
docker run -ti --rm -v /path/to/your/config.yml:/config.yml --device /dev/i2c-0 flyte/mqtt-gpio
277+
```
278+
279+
If you aren't able to find the exact device path to use, then you can also run the docker container in `--privileged` mode which will pass all of the devices through from the host:
280+
281+
```
282+
docker run -ti --rm -v /path/to/your/config.yml:/config.yml --privileged flyte/mqtt-gpio
283+
```
284+
285+
_Please raise an issue on Github if any of this information is incorrect._

0 commit comments

Comments
 (0)