diff --git a/Dockerfile b/Dockerfile index 431bd1605..7adbc1e6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,55 +1,34 @@ FROM php:8.3-apache ENV CI_ENV=docker +COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ + # Install dependencies -RUN set -e; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libzip-dev \ - libpng-dev \ - libjpeg-dev \ - libfreetype6-dev \ - cron \ - build-essential \ - ; \ - docker-php-ext-configure gd --with-freetype --with-jpeg; \ - \ - docker-php-ext-install -j "$(nproc)" \ +RUN apt-get update && apt-get install -y --no-install-recommends cron +RUN install-php-extensions \ mysqli \ zip \ - gd \ - ; \ + gd; \ \ a2enmod rewrite; \ - \ - apt-get clean; + apt-get clean # Enabling custom upload settings in PHP -RUN set -e; \ - \ - { \ - echo 'file_uploads = On'; \ - echo 'memory_limit = 256M'; \ - echo 'upload_max_filesize = 64M'; \ - echo 'post_max_size = 64M'; \ - echo 'max_execution_time = 600'; \ - } > $PHP_INI_DIR/conf.d/wavelog.ini; +RUN printf "file_uploads = On\n\ +memory_limit = 256M\n\ +upload_max_filesize = 64M\n\ +post_max_size = 64M\n\ +max_execution_time = 600\n" > $PHP_INI_DIR/conf.d/wavelog.ini # Copy proper file to target image COPY ./ /var/www/html/ WORKDIR /var/www/html # Setting permissions as: https://github.com/wavelog/Wavelog/wiki/Installation -RUN set -e; \ - \ - mkdir ./application/config/docker; \ - \ +RUN mkdir ./application/config/docker; \ mv ./htaccess.sample ./.htaccess; \ sed -i "s/\$config\['index_page'\] = 'index.php';/\$config\['index_page'\] = '';/g" ./install/config/config.php; \ - \ chown -R root:www-data /var/www/html; \ - \ chmod -R g+rw ./application/cache/; \ chmod -R g+rw ./application/config/; \ chmod -R g+rw ./application/logs/; \ @@ -62,15 +41,9 @@ RUN set -e; \ chmod -R g+rw ./install/; # Create the cron job -RUN set -e; \ - \ - touch /etc/cron.d/wavelog; \ - echo "* * * * * curl --silent http://localhost/index.php/cron/run &>/dev/null" >> /etc/cron.d/wavelog; \ - \ +RUN touch /etc/cron.d/wavelog; \ + echo "* * * * * php /var/www/html/index.php cron run &>/dev/null" >> /etc/cron.d/wavelog; \ chmod 0644 /etc/cron.d/wavelog;\ - \ crontab /etc/cron.d/wavelog;\ - \ mkdir -p /var/log/cron; \ - \ sed -i 's/^exec /service cron start\n\nexec /' /usr/local/bin/apache2-foreground;