mirror of https://github.com/Nardo86/zm-docker.git
BREAKING CHANGE: Only work for arm64 architecture
feat: Build zoneminder 1.36.24 for arm64 directly from sources feat: Entrypoint updated for graceful container stop fix: Entrypoint optimizations
This commit is contained in:
parent
79d03786e7
commit
6ba11b93a5
67
Dockerfile
67
Dockerfile
|
@ -14,29 +14,60 @@ libapache2-mod-php \
|
||||||
php-mysql
|
php-mysql
|
||||||
|
|
||||||
RUN apt-get install -y \
|
RUN apt-get install -y \
|
||||||
apt-transport-https \
|
libavcodec58 \
|
||||||
gnupg \
|
libavdevice58 \
|
||||||
wget \
|
libavformat58 \
|
||||||
msmtp \
|
libavutil56 \
|
||||||
msmtp-mta
|
libcurl3-gnutls \
|
||||||
|
libjpeg62-turbo \
|
||||||
RUN wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | apt-key add - \
|
libswresample3 \
|
||||||
&& echo 'deb https://zmrepo.zoneminder.com/debian/release-1.36 bullseye/' >> /etc/apt/sources.list
|
libswscale5 \
|
||||||
|
sudo \
|
||||||
RUN apt-get update
|
javascript-common \
|
||||||
|
ffmpeg \
|
||||||
RUN apt-get install -y \
|
libcurl4-gnutls-dev \
|
||||||
zoneminder
|
libdatetime-perl \
|
||||||
|
libdate-manip-perl \
|
||||||
|
libmime-lite-perl \
|
||||||
|
libmime-tools-perl \
|
||||||
|
libdbd-mysql-perl \
|
||||||
|
libphp-serialization-perl \
|
||||||
|
libnet-sftp-foreign-perl \
|
||||||
|
libarchive-zip-perl \
|
||||||
|
libdevice-serialport-perl \
|
||||||
|
libimage-info-perl \
|
||||||
|
libjson-maybexs-perl \
|
||||||
|
libsys-mmap-perl \
|
||||||
|
liburi-encode-perl \
|
||||||
|
libwww-perl \
|
||||||
|
libdata-dump-perl \
|
||||||
|
libclass-std-fast-perl \
|
||||||
|
libsoap-wsdl-perl \
|
||||||
|
libio-socket-multicast-perl \
|
||||||
|
libsys-cpu-perl \
|
||||||
|
libsys-meminfo-perl \
|
||||||
|
libdata-uuid-perl \
|
||||||
|
libnumber-bytes-human-perl \
|
||||||
|
libfile-slurp-perl \
|
||||||
|
php-gd \
|
||||||
|
php-apcu \
|
||||||
|
php-intl \
|
||||||
|
policykit-1 \
|
||||||
|
rsyslog \
|
||||||
|
zip \
|
||||||
|
libcrypt-eksblowfish-perl \
|
||||||
|
libdata-entropy-perl \
|
||||||
|
libvncclient1 \
|
||||||
|
libjwt-gnutls0 \
|
||||||
|
libgsoap-2.8.104 \
|
||||||
|
tzdata
|
||||||
|
|
||||||
RUN adduser www-data video
|
RUN adduser www-data video
|
||||||
|
|
||||||
RUN a2enmod ssl \
|
|
||||||
&& a2enmod rewrite \
|
|
||||||
&& a2enconf zoneminder \
|
|
||||||
&& a2ensite default-ssl.conf
|
|
||||||
|
|
||||||
RUN mkdir /config
|
RUN mkdir /config
|
||||||
|
|
||||||
|
COPY zoneminder_1.36.24~20220823.0-bullseye_arm64.deb /
|
||||||
|
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -1,6 +1,25 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
#echo $TZ > /etc/timezone
|
|
||||||
|
trap stop SIGTERM SIGINT SIGQUIT SIGHUP ERR
|
||||||
|
|
||||||
|
start(){
|
||||||
|
|
||||||
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
dpkg-reconfigure --frontend noninteractive tzdata
|
||||||
|
|
||||||
|
#install from package
|
||||||
|
echo "Check ZoneMinder version"
|
||||||
|
RESULT=$(dpkg -l | grep '^ii' | grep zoneminder |grep 1.36.24)
|
||||||
|
if [ "$RESULT" == "" ]; then
|
||||||
|
echo "Installing new version"
|
||||||
|
dpkg -i /zoneminder_1.36.24~20220823.0-bullseye_arm64.deb
|
||||||
|
a2enmod ssl \
|
||||||
|
&& a2enmod rewrite \
|
||||||
|
&& a2enconf zoneminder \
|
||||||
|
&& a2ensite default-ssl.conf
|
||||||
|
else
|
||||||
|
echo "Already up to date"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Configuring MariaDBPath"
|
echo "Configuring MariaDBPath"
|
||||||
if [ ! -d /config/mysql ]; then
|
if [ ! -d /config/mysql ]; then
|
||||||
|
@ -16,7 +35,7 @@ echo 'innodb_buffer_pool_size = 256M' >> /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
echo 'innodb_log_file_size = 32M' >> /etc/mysql/mariadb.conf.d/50-server.cnf
|
echo 'innodb_log_file_size = 32M' >> /etc/mysql/mariadb.conf.d/50-server.cnf
|
||||||
|
|
||||||
echo "Check MariaDB config"
|
echo "Check MariaDB config"
|
||||||
/etc/init.d/mysql start
|
/etc/init.d/mariadb start
|
||||||
while ! mysqladmin ping --silent; do
|
while ! mysqladmin ping --silent; do
|
||||||
echo "Waiting mysql startup..."
|
echo "Waiting mysql startup..."
|
||||||
sleep 3
|
sleep 3
|
||||||
|
@ -69,9 +88,9 @@ fi
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
RESULT=$(cat /etc/php/*/apache2/php.ini| grep "date.timezone =")
|
RESULT=$(cat /etc/php/*/apache2/php.ini| grep "date.timezone =")
|
||||||
if [ "$RESULT" != "date.timezone = $(sed 's/\\/\//' /etc/timezone)" ]; then
|
if [ "$RESULT" = ";date.timezone =" ]; then
|
||||||
echo "Set Php timezone"
|
echo "Set Php timezone"
|
||||||
sed -i "s/;date.timezone =/date.timezone = $(sed 's/\\/\//' /etc/timezone)/g" /etc/php/*/apache2/php.ini
|
printf "date.timezone = $(cat /etc/timezone)" >> /etc/php/*/apache2/php.ini
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Checking MSMTP configuration"
|
echo "Checking MSMTP configuration"
|
||||||
|
@ -107,7 +126,7 @@ if [ "$RESULT" = "" ]; then
|
||||||
echo "ServerName "$FQDN >> /etc/apache2/apache2.conf
|
echo "ServerName "$FQDN >> /etc/apache2/apache2.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Seting /var/cache subfolders"
|
echo "Setting /var/cache subfolders"
|
||||||
mkdir -p /var/cache/zoneminder/cache && chown www-data:www-data /var/cache/zoneminder/cache
|
mkdir -p /var/cache/zoneminder/cache && chown www-data:www-data /var/cache/zoneminder/cache
|
||||||
mkdir -p /var/cache/zoneminder/events && chown www-data:www-data /var/cache/zoneminder/events
|
mkdir -p /var/cache/zoneminder/events && chown www-data:www-data /var/cache/zoneminder/events
|
||||||
mkdir -p /var/cache/zoneminder/images && chown www-data:www-data /var/cache/zoneminder/images
|
mkdir -p /var/cache/zoneminder/images && chown www-data:www-data /var/cache/zoneminder/images
|
||||||
|
@ -118,14 +137,35 @@ echo "Starting"
|
||||||
/etc/init.d/apache2 start
|
/etc/init.d/apache2 start
|
||||||
/usr/bin/zmpkg.pl start
|
/usr/bin/zmpkg.pl start
|
||||||
|
|
||||||
RESULT=$(tail -n1 /var/log/zm/zmpkg.log |grep "Version mismatch")
|
RESULT=$(tail -n2 /var/log/zm/zmpkg.log |grep "Version mismatch")
|
||||||
if [ "$RESULT" != "" ]; then
|
if [ "$RESULT" != "" ]; then
|
||||||
echo "WARNING: DB version mismatch found!"
|
echo "WARNING: DB version mismatch found!"
|
||||||
echo "auto align.."
|
echo "auto align.."
|
||||||
/usr/bin/zmpkg.pl stop
|
/usr/bin/zmpkg.pl stop
|
||||||
/usr/bin/zmupdate.pl -nointeractive
|
/usr/bin/zmupdate.pl -nointeractive
|
||||||
|
/usr/bin/zmupdate.pl -f
|
||||||
/usr/bin/zmpkg.pl start
|
/usr/bin/zmpkg.pl start
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tail -f /var/log/apache2/error.log
|
tail -f /var/log/apache2/error.log & wait ${!}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
stop(){
|
||||||
|
|
||||||
|
echo "Shutdown requested"
|
||||||
|
kill ${!};
|
||||||
|
|
||||||
|
echo "Stopping apache"
|
||||||
|
/etc/init.d/apache2 stop
|
||||||
|
echo "Stopping zoneminder"
|
||||||
|
/usr/bin/zmpkg.pl stop
|
||||||
|
echo "Stopping mariadb"
|
||||||
|
/etc/init.d/mariadb stop
|
||||||
|
|
||||||
|
echo "Shutdown completed"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue