FROM php:8.5.12-apache-bookworm
ENV AEN_HTMX_SESSION_DIR=/tmp/htmx-sessions
RUN printf 'expose_php=Off\ndisplay_errors=Off\nlog_errors=On\nerror_log=/proc/self/fd/2\npost_max_size=16K\nupload_max_filesize=1K\nfile_uploads=Off\nmax_execution_time=10\nsession.save_path=/tmp/htmx-sessions\nsession.gc_probability=1\nsession.gc_divisor=100\n' > /usr/local/etc/php/conf.d/htmx-demo.ini \
    && mkdir -p /tmp/htmx-sessions && chown www-data:www-data /tmp/htmx-sessions
COPY public/ /var/www/html/
RUN printf 'SetEnvIf X-Forwarded-Proto "^https$" HTTPS=on\n<Directory /var/www/html>\nOptions -Indexes\n<Files "_app.php">\nRequire all denied\n</Files>\n</Directory>\n' > /etc/apache2/conf-enabled/htmx-demo.conf
