This commit is contained in:
Eros Nardi 2021-01-12 18:33:21 +01:00
commit e22882bd66
3 changed files with 89 additions and 0 deletions

37
Dockerfile Normal file
View File

@ -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

14
README.md Normal file
View File

@ -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

38
entrypoint.sh Normal file
View File

@ -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 <<EOF
y
$secret
$secret
y
y
y
y
EOF
#set timezone
echo "[mysqld]\n default-time-zone=$(cat /etc/timezone)" >> /etc/mysql/my.cnf
/etc/init.d/mysql restart
fi
#start
/etc/init.d/apache2 start
/usr/bin/zmpkg.pl start