Compare commits
10
Commits
main
..
9d7f828bc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d7f828bc2 | ||
|
|
4161d70f54 | ||
|
|
426bd085ad | ||
|
|
69d1b32c7c | ||
|
|
03c90eb26a | ||
|
|
ee212c721b | ||
|
|
b9626c73fa | ||
|
|
f097ea5980 | ||
|
|
41334b438c | ||
|
|
3ccb858013 |
+67
-56
@@ -1,80 +1,91 @@
|
||||
FROM debian:bookworm-slim
|
||||
FROM php:8.1-apache
|
||||
|
||||
# PHP 7.4 from deb.sury.org: the official php:7.4-apache image is frozen at 7.4.33
|
||||
# (2022), while sury keeps backporting security fixes (e.g. CVE-2026-109618/109619)
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg \
|
||||
&& curl -fsSL https://packages.sury.org/php/apt.gpg -o /usr/share/keyrings/sury-php.gpg \
|
||||
&& echo "deb [signed-by=/usr/share/keyrings/sury-php.gpg] https://packages.sury.org/php/ bookworm main" \
|
||||
> /etc/apt/sources.list.d/sury-php.list \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Apache, PHP 7.4 with the extensions Moodle needs, and tools
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
apache2 \
|
||||
libapache2-mod-php7.4 \
|
||||
php7.4-cli \
|
||||
php7.4-curl \
|
||||
php7.4-gd \
|
||||
php7.4-imagick \
|
||||
php7.4-intl \
|
||||
php7.4-mbstring \
|
||||
php7.4-mysql \
|
||||
php7.4-opcache \
|
||||
php7.4-readline \
|
||||
php7.4-redis \
|
||||
php7.4-soap \
|
||||
php7.4-sqlite3 \
|
||||
php7.4-xml \
|
||||
php7.4-xmlrpc \
|
||||
php7.4-zip \
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
git \
|
||||
unzip \
|
||||
libpng-dev \
|
||||
libjpeg-dev \
|
||||
libfreetype6-dev \
|
||||
libxml2-dev \
|
||||
libzip-dev \
|
||||
libonig-dev \
|
||||
libicu-dev \
|
||||
libxslt-dev \
|
||||
libmcrypt-dev \
|
||||
zlib1g-dev \
|
||||
libssl-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libpq-dev \
|
||||
nano \
|
||||
curl \
|
||||
wget \
|
||||
cron \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& ln -s /usr/bin/php7.4 /usr/local/bin/php
|
||||
libmagickwand-dev --no-install-recommends
|
||||
|
||||
# Apache: same behaviour as the official php:apache image
|
||||
COPY apache-php.conf /etc/apache2/conf-available/docker-php.conf
|
||||
RUN a2enconf docker-php \
|
||||
&& a2enmod rewrite headers \
|
||||
&& ln -sfT /dev/stdout /var/log/apache2/access.log \
|
||||
&& ln -sfT /dev/stderr /var/log/apache2/error.log \
|
||||
&& ln -sfT /dev/stdout /var/log/apache2/other_vhosts_access.log
|
||||
# Enable Apache mods
|
||||
RUN a2enmod rewrite headers
|
||||
|
||||
# Install Moosh 1.25 (same release as the old moodle.org zip, which is gone)
|
||||
RUN git clone -q --depth 1 -b 1.25 https://github.com/tmuras/moosh.git /opt/moosh && \
|
||||
curl -fsSL https://getcomposer.org/download/2.2.25/composer.phar -o /tmp/composer.phar && \
|
||||
cd /opt/moosh && php /tmp/composer.phar install -q --no-dev --no-interaction && \
|
||||
rm /tmp/composer.phar && \
|
||||
ln -s /opt/moosh/moosh.php /usr/local/bin/moosh
|
||||
# Install PHP extensions required by Moodle
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install -j$(nproc) \
|
||||
gd \
|
||||
intl \
|
||||
mbstring \
|
||||
xml \
|
||||
soap \
|
||||
zip \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
opcache \
|
||||
mysqli \
|
||||
xsl \
|
||||
curl \
|
||||
exif
|
||||
|
||||
# PHP config
|
||||
COPY moodle-php.ini /etc/php/7.4/apache2/conf.d/90-moodle.ini
|
||||
COPY moodle-php.ini /etc/php/7.4/cli/conf.d/90-moodle.ini
|
||||
# Install Moosh (phar build straight from the upstream GitHub release)
|
||||
RUN wget -q -O /usr/local/bin/moosh \
|
||||
https://github.com/tmuras/moosh/releases/download/phar-latest/moosh.phar \
|
||||
&& chmod +x /usr/local/bin/moosh
|
||||
|
||||
# Moodle data dir
|
||||
|
||||
# Install Redis extension
|
||||
RUN pecl install redis && \
|
||||
docker-php-ext-enable redis
|
||||
|
||||
RUN pecl install channel://pecl.php.net/xmlrpc-1.0.0RC3 && docker-php-ext-enable xmlrpc
|
||||
|
||||
# Optional: Install and enable Imagick (used by Moodle for better image processing)
|
||||
RUN pecl install imagick && docker-php-ext-enable imagick
|
||||
|
||||
# Install Xdebug
|
||||
RUN pecl install xdebug \
|
||||
&& docker-php-ext-enable xdebug
|
||||
|
||||
# Set recommended PHP configuration values for Moodle
|
||||
COPY moodle-php.ini /usr/local/etc/php/conf.d/moodle-php.ini
|
||||
|
||||
# Copy custom php.ini
|
||||
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
|
||||
|
||||
# Create moodledata directory
|
||||
RUN mkdir -p /var/www/moodledata && \
|
||||
chown -R www-data:www-data /var/www/moodledata && \
|
||||
chmod -R 770 /var/www/moodledata
|
||||
|
||||
# Cron
|
||||
|
||||
# Set up Moodle cron job
|
||||
COPY moodle-cron /etc/cron.d/moodle-cron
|
||||
RUN chmod 0644 /etc/cron.d/moodle-cron && \
|
||||
crontab /etc/cron.d/moodle-cron
|
||||
|
||||
# Startup script
|
||||
# Create startup script to run cron and apache
|
||||
COPY start.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/start.sh
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Traefik picks the backend port from EXPOSE (php:7.4-apache declared it)
|
||||
EXPOSE 80
|
||||
|
||||
# Set entrypoint to our startup script
|
||||
ENTRYPOINT ["/usr/local/bin/start.sh"]
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<FilesMatch \.php$>
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
|
||||
DirectoryIndex disabled
|
||||
DirectoryIndex index.php index.html
|
||||
|
||||
<Directory /var/www/>
|
||||
Options -Indexes
|
||||
AllowOverride All
|
||||
</Directory>
|
||||
@@ -48,7 +48,6 @@ services:
|
||||
|
||||
redis:
|
||||
image: 'redis:alpine'
|
||||
restart: always
|
||||
volumes:
|
||||
- ./redis_data:/data
|
||||
healthcheck:
|
||||
|
||||
@@ -2,3 +2,4 @@ upload_max_filesize = 128M
|
||||
post_max_size = 128M
|
||||
memory_limit = 512M
|
||||
max_execution_time = 300
|
||||
max_input_vars = 10000
|
||||
@@ -0,0 +1,4 @@
|
||||
services:
|
||||
mysql:
|
||||
ports:
|
||||
- "3307:3306"
|
||||
@@ -0,0 +1,4 @@
|
||||
services:
|
||||
mysql:
|
||||
ports:
|
||||
- "3308:3306"
|
||||
@@ -3,6 +3,4 @@
|
||||
service cron start
|
||||
|
||||
# Start Apache in foreground
|
||||
. /etc/apache2/envvars
|
||||
rm -f "$APACHE_PID_FILE"
|
||||
exec apache2 -DFOREGROUND
|
||||
apache2-foreground
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
zend_extension=xdebug
|
||||
|
||||
xdebug.mode=debug
|
||||
xdebug.start_with_request=yes
|
||||
xdebug.client_host=172.17.80.1
|
||||
xdebug.client_port=9003
|
||||
xdebug.log=/tmp/xdebug.log
|
||||
|
||||
; Optional for development
|
||||
xdebug.discover_client_host=true
|
||||
xdebug.idekey=VSCODE
|
||||
Reference in New Issue
Block a user