From b98fdcfd762a4160f216bbad9328ccb15b0c4126 Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Sat, 5 Jun 2021 12:56:42 +0200 Subject: [PATCH] ADD: divided application and configuration directory --- Dockerfile | 9 ++++----- docker-entrypoint-wikindx | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf1c59f..45a7c86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM php:7-apache-buster -WORKDIR /home/ +WORKDIR /var/www/html RUN sed -i 's/deb.debian.org/ftp.de.debian.org/g' /etc/apt/sources.list RUN apt-get -q -y update && apt-get -q -y upgrade RUN apt-get -q -y install default-libmysqlclient-dev wget mariadb-server @@ -11,12 +11,9 @@ RUN docker-php-ext-install gettext && docker-php-ext-enable gettext RUN docker-php-ext-install intl && docker-php-ext-enable intl RUN docker-php-ext-install zip && docker-php-ext-enable zip RUN docker-php-ext-install ldap && docker-php-ext-enable ldap -RUN wget -O wikindx.tar.bz2 https://phoenixnap.dl.sourceforge.net/project/wikindx/6.4.9/wikindx_6.4.9.tar.bz2 -RUN tar jxf wikindx.tar.bz2 -RUN cp wikindx/config.php.dist wikindx/config.php + COPY create.sql . COPY docker-entrypoint-wikindx /usr/local/bin/ -RUN chown www-data.www-data wikindx -R RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini RUN sed -i 's/post_max_size.=.*/post_max_size = 100M/' /usr/local/etc/php/php.ini @@ -27,4 +24,6 @@ RUN echo "mysqli.default_socket = /var/run/mysqld/mysqld.sock" >> /usr/local/etc VOLUME ["/var/lib/mysql"] VOLUME ["/home/wikindx"] +RUN wget -O wikindx.tar.bz2 https://phoenixnap.dl.sourceforge.net/project/wikindx/6.4.9/wikindx_6.4.9.tar.bz2;tar jxf wikindx.tar.bz2 + ENTRYPOINT ["docker-entrypoint-wikindx"] diff --git a/docker-entrypoint-wikindx b/docker-entrypoint-wikindx index f7389bd..8e48e2c 100755 --- a/docker-entrypoint-wikindx +++ b/docker-entrypoint-wikindx @@ -7,9 +7,37 @@ if [ ! -d /var/lib/mysql/wikindx6 ] ; then mysql -u root < create.sql fi -if [ ! -d /var/www/html/wikindx ]; then - mv /home/wikindx /var/www/html/ + +# for updating from old docker container +if [ -e /home/wikindx/index.php ]; then + echo -n "found application in config directory ..." + mv /home/wikindx/config.php /tmp/ + rm /home/wikindx/* -rf + mv /tmp/config.php /home/wikindx/config.php + chown -R www-data.www-data /home/wikindx + echo "removed" +fi + +# make sure a configuration file exists +if [ ! -e /home/wikindx/config.php ]; then + echo "no configuration file yet exist ..." + cp /var/www/html/config.php.dist /home/wikindx/config.php + chown -R www-data.www-data /home/wikindx + echo "created" +fi + +# make sure application is unpacked +if [ ! -e /var/www/html/wikindx/index.php ]; then + cd /var/www/html + tar jxf wikindx.tar.bz2 +fi + +# make sure configuration file is linked to application directory +if [ ! -e /var/www/html/wikindx/config.php ]; then + echo "No link to configuration found in application directory ..." + ln -s /home/wikindx/config.php /var/www/html/wikindx/config.php chown -R www-data.www-data /var/www/html/wikindx + echo "created" fi docker-php-entrypoint apache2-foreground