diff --git a/Dockerfile b/Dockerfile index 1f39d96..82f12eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,15 +17,16 @@ RUN apt-get install -y \ apt-transport-https \ gnupg \ wget \ -&& wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | apt-key add - \ +msmtp \ +msmtp-mta + +RUN wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | apt-key add - \ && echo 'deb https://zmrepo.zoneminder.com/debian/release-1.34 buster/' >> /etc/apt/sources.list RUN apt-get update RUN apt-get install -y \ -zoneminder \ -msmtp \ -msmtp-mta +zoneminder RUN adduser www-data video @@ -37,7 +38,7 @@ RUN a2enmod ssl \ RUN mkdir /config COPY entrypoint.sh / -run chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] VOLUME /config diff --git a/README.md b/README.md index f590697..b020208 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# ZONEMINDER +# ZONEMINDER 1.34 -This is a simple debian image with the ZoneMinder installed following the official instructions https://wiki.zoneminder.com/Debian_10_Buster_with_Zoneminder_1.34.x_from_ZM_Repo. +This is a simple debian image with the ZoneMinder 1.34 installed following the official instructions https://wiki.zoneminder.com/Debian_10_Buster_with_Zoneminder_1.34.x_from_ZM_Repo. Because of the ssmtp deprecation the mail server installed is msmtp and a default configuration file prepared for GMail will be created in /config/msmtprc. Furthermore the image is prepared for working with SWAG(let's encrypt) image or there is an environment for the self-signed certificate option. -Image available at https://hub.docker.com/r/nardo86/zoneminder +Image available at https://hub.docker.com/r/nardo86/zoneminder with tag 1.34 Feel free to consider donating if my work helped you! https://paypal.me/ErosNardi @@ -41,11 +41,12 @@ Just run the image publishing the port and setting the ENV variables, the shm de ` --restart unless-stopped \` -` nardo86/zoneminder` +` nardo86/zoneminder:1.34` -The SELFSIGNED flag will , the FQDN will be used for configuring Apache2 and, in case of using the SWAG certificate, find the correct folder and the /config folder will contain msmtp and mysql configuration. +The FQDN will be used for configuring Apache2; the SELFSIGNED flag will generate a selfsigned certificate if needed else, in case of using the SWAG certificate, the system find the correct folder. +The /config folder will contain msmtp and mysql configuration. -The shm-size will be the quantity of RAM dedicated to /dev/shm.* +The shm-size will be the quantity of RAM dedicated to /dev/shm, the size depends on the number and settings of the video sources to monitor, check ZoneMinder configuration for further information.* **be sure to not reserve too much RAM to this machine or the docker server wil start to paging and eventually becoming unresponsible** @@ -88,4 +89,4 @@ Environment variable used for the configuration Variable|Description|Default --------|-----------|------- SELFSIGNED|switch between using a self-signed certificate and the one in sslcert/live folder|0 -FQDN|the FQDN Apache2 will be listening to, sslcert/live subfolder if SELFSIGNED is 0 |localhost \ No newline at end of file +FQDN|the FQDN Apache2 will be listening to, sslcert/live subfolder if SELFSIGNED is 0 |localhost diff --git a/entrypoint.sh b/entrypoint.sh index c3c30a1..f3f09db 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,6 @@ #!/bin/bash -echo $TZ > /etc/timezone +#echo $TZ > /etc/timezone +ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone echo "Configuring MariaDBPath" if [ ! -d /config/mysql ]; then @@ -54,7 +55,7 @@ fi echo "Checking Timezones" RESULT=$(cat /etc/mysql/my.cnf| grep default-time-zone) -if [ "$RESULT" = "" ]; then +if [ "$RESULT" != "default-time-zone=$(cat /etc/timezone)" ]; then echo "Set Mysql timezone" printf "[mysqld]\n default-time-zone=$(cat /etc/timezone)" >> /etc/mysql/my.cnf /etc/init.d/mysql restart @@ -65,9 +66,9 @@ if [ "$RESULT" = "" ]; then fi RESULT=$(cat /etc/php/*/apache2/php.ini| grep "date.timezone =") -if [ "$RESULT" = ";date.timezone =" ]; then +if [ "$RESULT" != "date.timezone = $(sed 's/\\/\//' /etc/timezone)" ]; then echo "Set Php timezone" - sed -i "s/;date.timezone =/date.timezone = $(sed 's/\//\\\//' /etc/timezone)/g" /etc/php/*/apache2/php.ini + sed -i "s/;date.timezone =/date.timezone = $(sed 's/\\/\//' /etc/timezone)/g" /etc/php/*/apache2/php.ini fi echo "Checking MSMTP configuration" @@ -92,7 +93,7 @@ ln -s /config/msmtprc /etc/msmtprc fi if [ "$SELFSIGNED" = "0" ]; then -echo "Configuro collegamento a swag" +echo "Linking to SWAG" sed -i -e 's,/etc/ssl/certs/ssl-cert-snakeoil.pem,/sslcert/live/'$FQDN'/cert.pem,g' /etc/apache2/sites-available/default-ssl.conf sed -i -e 's,/etc/ssl/private/ssl-cert-snakeoil.key,/sslcert/live/'$FQDN'/privkey.pem,g' /etc/apache2/sites-available/default-ssl.conf fi