This commit is contained in:
Wolfgang Hottgenroth 2022-09-14 12:07:14 +02:00
parent 11cdca647f
commit 1360195f67
5 changed files with 23 additions and 2 deletions

View File

@ -21,9 +21,11 @@ RUN \
COPY opt/ /opt
COPY etc/ /opt/etc
COPY supervisor-mosquitto.conf /etc/supervisor/conf.d/
COPY crontab /etc/crontab
VOLUME /opt/etc
VOLUME /opt/data
VOLUME /var/log/supervisor
EXPOSE 80/TCP
EXPOSE 443/TCP
@ -33,5 +35,5 @@ EXPOSE 9001/tcp
WORKDIR /opt
CMD ["env", "LD_LIBRARY_PATH=/opt/lib", "/opt/sbin/mosquitto", "-c", "/opt/etc/mosquitto/mosquitto.conf"]
CMD [ "/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf" ]

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019 Wolfgang Hottgenroth
Copyright (c) 2019, 2022 Wolfgang Hottgenroth
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

3
crontab Normal file
View File

@ -0,0 +1,3 @@
SHELL=/bin/sh
PATH=/usr/bin
*/2 * * * * root supervisorctl start certbot

View File

@ -3,20 +3,25 @@
IMAGE=registry.gitlab.com/wolutator/mosquitto-with-auth:latest
VOLUME_CONFIG=mosquitto-config
VOLUME_DATA=mosquitto-data
VOLUME_LOG
docker volume inspect $VOLUME_CONFIG > /dev/null || docker volume create $VOLUME_CONFIG
docker volume inspect $VOLUME_DATA > /dev/null || docker volume create $VOLUME_DATA
docker volume inspect $VOLUME_LOG > /dev/null || docker volume create $VOLUME_LOG
docker pull $IMAGE
docker run \
-d \
--rm \
-p80:80 \
-p443:443 \
-p1883:1883 \
-p8883:8883 \
-p9001:9001 \
-v $VOLUME_CONFIG:/opt/etc/mosquitto \
-v $VOLUME_DATA:/opt/data \
-v $VOLUME_LOG:/var/log/supervisor \
--link mariadb \
--name mosquitto \
$IMAGE

View File

@ -1,3 +1,7 @@
[supervisord]
nodaemon=true
user=root
[program:mosquitto]
environment=LD_LIBRARY_PATH="/opt/lib"
command=/opt/sbin/mosquitto -c /opt/etc/mosquitto/mosquitto.conf
@ -8,3 +12,10 @@ autorestart=true
command=/usr/bin/certbot renew --standalone
autostart=false
autorestart=false
startsecs=0
[program:cron]
command=/usr/sbin/cron -f
autostart=true
autorestart=true