Skip to content

Commit

Permalink
Dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
eschava committed Mar 25, 2021
1 parent 0788784 commit 7dff701
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM python:3.7.9

# based on https://github.com/pfichtner/docker-mqttwarn

# install python libraries
#RUN pip install -r requirements.txt

RUN mkdir -p /opt/psmqtt
WORKDIR /opt/psmqtt
RUN mkdir -p /var/log/psmqtt

COPY ./requirements.txt /opt/psmqtt
RUN pip install -r /opt/psmqtt/requirements.txt

# add user psmqtt to image
RUN groupadd -r psmqtt && useradd -r -g psmqtt psmqtt
RUN chown -R psmqtt:psmqtt /opt/psmqtt
RUN chown -R psmqtt:psmqtt /var/log/psmqtt
#RUN chown -R psmqtt /home/psmqtt

# process run as psmqtt user
USER psmqtt

# conf file from host
VOLUME ["/opt/psmqtt/conf"]

# set conf path
ENV PSMQTTCONFIG="/opt/psmqtt/conf/psmqtt.conf"

# finally, copy the current code (ideally we'd copy only what we need, but it
# is not clear what that is, yet)
COPY . /opt/psmqtt

# run process
CMD python psmqtt.py

0 comments on commit 7dff701

Please sign in to comment.