From e22882bd66f66ab5007ce2d5d850fe2299725937 Mon Sep 17 00:00:00 2001 From: Eros Nardi Date: Tue, 12 Jan 2021 18:33:21 +0100 Subject: [PATCH] initial --- Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ README.md | 14 ++++++++++++++ entrypoint.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5a723f3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM debian:buster-slim +#https://wiki.zoneminder.com/Debian_10_Buster_with_Zoneminder_1.34.x_from_ZM_Repo +ENV TZ=UTC + +RUN apt-get update + +RUN apt-get install -y \ +apt-transport-https \ +gnupg \ +wget \ +&& 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 \ +apache2 \ +mariadb-server \ +php \ +libapache2-mod-php \ +php-mysql \ +zoneminder + +RUN adduser www-data video + +RUN a2enmod ssl \ +&& a2enmod rewrite \ +&& a2enconf zoneminder \ +&& a2ensite default-ssl.conf + +RUN sed -i "s/;date.timezone =/date.timezone = $(sed 's/\//\\\//' /etc/timezone)/g" /etc/php/*/apache2/php.ini + +COPY entrypoint.sh / +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 443/tcp +EXPOSE 9000/tcp diff --git a/README.md b/README.md new file mode 100644 index 0000000..29d5f8f --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# zm-docker + +**Zoneminder** + +This is a simple debian image with a LAMP base and ZoneMinder +Image available at https://hub.docker.com/r/nardo86/zm + +**USAGE** + +todo + +**EXTRA OPTIONS** + +todo \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..df56c09 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +/etc/init.d/mysql start + +RESULT=$(mysqlshow --user=zmuser --password=zmpass zm| grep -v Wildcard | grep -o Tables) +if [ "$RESULT" != "Tables" ] +then + +#configure mysql +echo "USE mysql;" > timezones.sql && mysql_tzinfo_to_sql /usr/share/zoneinfo >> timezones.sql +mysql -u root < timezones.sql +rm timezones.sql +mysql -u root < /usr/share/zoneminder/db/zm_create.sql +mysql -u root -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';" +mysqladmin -u root reload + +#secure mysql +secret=$(openssl rand -base64 14) +mysql_secure_installation <> /etc/mysql/my.cnf +/etc/init.d/mysql restart + +fi + +#start +/etc/init.d/apache2 start +/usr/bin/zmpkg.pl start