Compare commits

3 Commits

Author SHA1 Message Date
gavgeris 590206524c Install libs than build them 2026-05-03 13:28:19 +03:00
gavgeris c0e6b9e5d9 always restart redis 2025-08-23 15:09:08 +03:00
gavgeris 60e731b6fd Add always restart 2025-07-31 12:06:53 +03:00
2 changed files with 29 additions and 32 deletions
+26 -32
View File
@@ -4,6 +4,10 @@ FROM php:7.4-apache
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \
unzip \ unzip \
nano \
curl \
wget \
cron \
libpng-dev \ libpng-dev \
libjpeg-dev \ libjpeg-dev \
libfreetype6-dev \ libfreetype6-dev \
@@ -17,18 +21,16 @@ RUN apt-get update && apt-get install -y \
libssl-dev \ libssl-dev \
libcurl4-openssl-dev \ libcurl4-openssl-dev \
libpq-dev \ libpq-dev \
nano \ libmagickwand-dev \
curl \ --no-install-recommends \
wget \ && rm -rf /var/lib/apt/lists/*
cron \
libmagickwand-dev --no-install-recommends
# Enable Apache mods # Install PHP extensions (fast method)
RUN a2enmod rewrite headers 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 chmod +x /usr/local/bin/install-php-extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \ RUN install-php-extensions \
gd \ gd \
intl \ intl \
mbstring \ mbstring \
@@ -36,50 +38,42 @@ RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
xmlrpc \ xmlrpc \
soap \ soap \
zip \ zip \
pdo \
pdo_mysql \ pdo_mysql \
opcache \
mysqli \ mysqli \
opcache \
xsl \ xsl \
curl \ curl \
exif exif \
redis \
imagick
# Download and install Moosh # Enable Apache mods
RUN a2enmod rewrite headers
# Install Moosh
RUN cd /opt && \ RUN cd /opt && \
wget https://moodle.org/plugins/download.php/33902/moosh_moodle45_2024111400.zip && \ wget https://moodle.org/plugins/download.php/33902/moosh_moodle45_2024111400.zip && \
unzip moosh_moodle45_2024111400.zip && \ unzip moosh_moodle45_2024111400.zip && \
ln -s /opt/moosh/moosh.php /usr/local/bin/moosh && \ ln -s /opt/moosh/moosh.php /usr/local/bin/moosh && \
rm moosh_moodle45_2024111400.zip # Clean up zip file rm moosh_moodle45_2024111400.zip
# PHP config
# 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
COPY moodle-php.ini /usr/local/etc/php/conf.d/moodle-php.ini 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 && \ RUN mkdir -p /var/www/moodledata && \
chown -R www-data:www-data /var/www/moodledata && \ chown -R www-data:www-data /var/www/moodledata && \
chmod -R 770 /var/www/moodledata chmod -R 770 /var/www/moodledata
# Cron
# Set up Moodle cron job
COPY moodle-cron /etc/cron.d/moodle-cron COPY moodle-cron /etc/cron.d/moodle-cron
RUN chmod 0644 /etc/cron.d/moodle-cron && \ RUN chmod 0644 /etc/cron.d/moodle-cron && \
crontab /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/ COPY start.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/start.sh RUN chmod +x /usr/local/bin/start.sh
# Set working directory
WORKDIR /var/www/html WORKDIR /var/www/html
# Set entrypoint to our startup script ENTRYPOINT ["/usr/local/bin/start.sh"]
ENTRYPOINT ["/usr/local/bin/start.sh"]
+3
View File
@@ -5,6 +5,7 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
restart: always
volumes: volumes:
- ./site_data:/var/www/html - ./site_data:/var/www/html
- ./moodledata:/var/www/moodledata - ./moodledata:/var/www/moodledata
@@ -24,6 +25,7 @@ services:
mysql: mysql:
image: 'mysql:8' image: 'mysql:8'
restart: always
# ports: # ports:
# - "127.0.0.1:5436:3306" # - "127.0.0.1:5436:3306"
volumes: volumes:
@@ -46,6 +48,7 @@ services:
redis: redis:
image: 'redis:alpine' image: 'redis:alpine'
restart: always
volumes: volumes:
- ./redis_data:/data - ./redis_data:/data
healthcheck: healthcheck: