From 590206524c5699cffdc6ba338ab6f7c4a7efa31e Mon Sep 17 00:00:00 2001 From: George Avgeris Date: Sun, 3 May 2026 13:28:19 +0300 Subject: [PATCH] Install libs than build them --- Dockerfile | 58 ++++++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2c50e3c..322d825 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,10 @@ FROM php:7.4-apache RUN apt-get update && apt-get install -y \ git \ unzip \ + nano \ + curl \ + wget \ + cron \ libpng-dev \ libjpeg-dev \ libfreetype6-dev \ @@ -17,18 +21,16 @@ RUN apt-get update && apt-get install -y \ libssl-dev \ libcurl4-openssl-dev \ libpq-dev \ - nano \ - curl \ - wget \ - cron \ - libmagickwand-dev --no-install-recommends + libmagickwand-dev \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* -# Enable Apache mods -RUN a2enmod rewrite headers +# Install PHP extensions (fast method) +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ -# Install PHP extensions required by Moodle -RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install -j$(nproc) \ +RUN chmod +x /usr/local/bin/install-php-extensions + +RUN install-php-extensions \ gd \ intl \ mbstring \ @@ -36,50 +38,42 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ xmlrpc \ soap \ zip \ - pdo \ pdo_mysql \ - opcache \ mysqli \ + opcache \ xsl \ curl \ - exif + exif \ + redis \ + imagick -# Download and install Moosh +# Enable Apache mods +RUN a2enmod rewrite headers + +# Install Moosh RUN cd /opt && \ wget https://moodle.org/plugins/download.php/33902/moosh_moodle45_2024111400.zip && \ unzip moosh_moodle45_2024111400.zip && \ ln -s /opt/moosh/moosh.php /usr/local/bin/moosh && \ - rm moosh_moodle45_2024111400.zip # Clean up zip file + rm moosh_moodle45_2024111400.zip - -# Install Redis extension -RUN pecl install redis && \ - docker-php-ext-enable redis - -# Optional: Install and enable Imagick (used by Moodle for better image processing) -RUN pecl install imagick && docker-php-ext-enable imagick - -# Set recommended PHP configuration values for Moodle +# PHP config COPY moodle-php.ini /usr/local/etc/php/conf.d/moodle-php.ini -# Create moodledata directory +# Moodle data dir RUN mkdir -p /var/www/moodledata && \ chown -R www-data:www-data /var/www/moodledata && \ chmod -R 770 /var/www/moodledata - -# Set up Moodle cron job +# Cron COPY moodle-cron /etc/cron.d/moodle-cron RUN chmod 0644 /etc/cron.d/moodle-cron && \ crontab /etc/cron.d/moodle-cron -# Create startup script to run cron and apache +# Startup script COPY start.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/start.sh -# Set working directory WORKDIR /var/www/html -# Set entrypoint to our startup script -ENTRYPOINT ["/usr/local/bin/start.sh"] - +ENTRYPOINT ["/usr/local/bin/start.sh"] \ No newline at end of file