Added Dockerfile

This commit is contained in:
mverleun
2018-07-05 09:01:43 +02:00
parent 7ca7c4873d
commit a343eb9f01

View File

@@ -9,15 +9,17 @@
# #
# Special attention is required to allow the container to access the USB device that is plugged into the host. # Special attention is required to allow the container to access the USB device that is plugged into the host.
# The container needs priviliged access to /dev/bus/usb on the host. # The container needs priviliged access to /dev/bus/usb on the host.
# #
# docker run --name rtl_433 -d -e MQTT_HOST=<mqtt-broker.example.com> --privileged -v /dev/bus/usb:/dev/bus/usb <image> # docker run --name rtl_433 -d -e MQTT_HOST=<mqtt-broker.example.com> --privileged -v /dev/bus/usb:/dev/bus/usb <image>
#FROM ubuntu:latest
FROM python:3.6.3 FROM python:3.6.3
MAINTAINER Marco Verleun MAINTAINER Marco Verleun
LABEL Description="This image is used to start a script that will monitor for events on 433,92 Mhz" Vendor="MarCoach" Version="1.0" LABEL Description="This image is used to start a script that will monitor for events on 433,92 Mhz" Vendor="MarCoach" Version="1.0"
# Install additional modules
RUN pip install paho-mqtt
# #
# First install software packages needed to compile rtl_433 and to publish MQTT events # First install software packages needed to compile rtl_433 and to publish MQTT events
# #
@@ -28,8 +30,8 @@ RUN apt-get update && apt-get install -y \
git \ git \
automake \ automake \
libtool \ libtool \
cmake cmake
# #
# Pull RTL_433 source code from GIT, compile it and install it # Pull RTL_433 source code from GIT, compile it and install it
# #
@@ -39,17 +41,17 @@ RUN git clone https://github.com/merbanan/rtl_433.git \
&& cd build \ && cd build \
&& cmake ../ \ && cmake ../ \
&& make \ && make \
&& make install && make install
# #
# Copy my script and make it executable # Copy config, script and make it executable
# #
COPY rtl2mqtt.py /scripts/rtl2mqtt.py COPY rtl2mqtt.py /scripts/rtl2mqtt.py
RUN chmod +x /scripts/rtl2mqtt.py COPY config.py /scripts/config.py
RUN chmod +x /scripts/rtl2mqtt.py
# #
# When running a container this script will be executed # When running a container this script will be executed
# #
# Install additional modules
RUN pip install paho-mqtt
#
ENTRYPOINT ["/scripts/rtl2mqtt.py"] ENTRYPOINT ["/scripts/rtl2mqtt.py"]