FROM php:8.2-apache # Match the container's web user to the host user so Grav can write to the # bind-mounted app/ folder (cache, logs, tmp, user uploads, ...). ARG PUID=1000 ARG PGID=1000 RUN groupmod -o -g "${PGID}" www-data \ && usermod -o -u "${PUID}" www-data # System deps for Grav's PHP extensions RUN apt-get update && apt-get install -y --no-install-recommends \ libzip-dev \ libpng-dev \ libjpeg-dev \ libfreetype6-dev \ libcurl4-openssl-dev \ libonig-dev \ libxml2-dev \ unzip \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j"$(nproc)" \ gd \ curl \ mbstring \ zip \ dom \ xml \ fileinfo \ exif \ opcache \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Grav ships its own .htaccess; enable rewrite + allow overrides RUN a2enmod rewrite headers RUN sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf # Sensible PHP settings for Grav RUN { \ echo 'memory_limit=256M'; \ echo 'upload_max_filesize=32M'; \ echo 'post_max_size=32M'; \ echo 'max_execution_time=120'; \ } > /usr/local/etc/php/conf.d/grav.ini WORKDIR /var/www/html