| # debian.sh --arch 'amd64' out/ 'trixie' '@1792531975' |
| ARG PHP_VERSION=8.1 |
| RUN |1 PHP_VERSION=8.1 /bin/sh -c apt-get update -y && apt-get install -y --no-install-recommends ca-certificates curl apt-transport-https lsb-release readline-common git zlib1g-dev && curl -L https://packages.sury.org/php/apt.gpg -o /etc/apt/trusted.gpg.d/php.gpg && echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && apt-get update -y && apt-get install -y --no-install-recommends ghostscript imagemagick apache2 msmtp msmtp-mta php${PHP_VERSION} php${PHP_VERSION}-bcmath php${PHP_VERSION}-cli php${PHP_VERSION}-common php${PHP_VERSION}-curl php${PHP_VERSION}-gd php${PHP_VERSION}-gmp php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring php${PHP_VERSION}-mysql php${PHP_VERSION}-opcache php${PHP_VERSION}-readline php${PHP_VERSION}-sqlite3 php${PHP_VERSION}-xml php${PHP_VERSION}-yaml php${PHP_VERSION}-zip php${PHP_VERSION}-apcu php${PHP_VERSION}-redis php${PHP_VERSION}-soap php${PHP_VERSION}-pgsql libapache2-mod-php${PHP_VERSION} && if dpkg --compare-versions "${PHP_VERSION}" lt "8.0"; then apt-get install -y --no-install-recommends php${PHP_VERSION}-sodium; fi && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/* # buildkit |
| RUN |1 PHP_VERSION=8.1 /bin/sh -c mkdir -p /var/www/html; chown www-data:www-data /var/www/html; chmod 1777 /var/www/html # buildkit |
| ENV APACHE_CONFDIR=/etc/apache2 |
| ENV APACHE_ENVVARS=/etc/apache2/envvars |
| RUN |1 PHP_VERSION=8.1 /bin/sh -c sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; . "$APACHE_ENVVARS"; for dir in "$APACHE_LOCK_DIR" "$APACHE_RUN_DIR" "$APACHE_LOG_DIR" ; do rm -rvf "$dir"; mkdir -p "$dir"; chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; chmod 1777 "$dir"; done; rm -rvf /var/www/html/*; ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" # buildkit |
| RUN |1 PHP_VERSION=8.1 /bin/sh -c ln -s /etc/php/${PHP_VERSION}/apache2/conf.d /etc/php/conf.d # buildkit |
| ARG TARGETARCH=amd64 |
| RUN |2 PHP_VERSION=8.1 TARGETARCH=amd64 /bin/sh -c { echo '; priority=10'; echo 'session.upload_progress.enabled = Off'; echo 'expose_php = Off'; if [ "$TARGETARCH" = "arm64" ]; then echo '; TEMP: CVE-2026-109618 mitigation until arm64 fixed packages land'; echo 'memory_limit = -1'; echo 'post_max_size = 32M'; fi; } > /etc/php/${PHP_VERSION}/mods-available/security.ini && phpenmod -v ${PHP_VERSION} security # buildkit |
| COPY apache/site.conf /etc/apache2/sites-available/site.conf # buildkit |
| RUN |2 PHP_VERSION=8.1 TARGETARCH=amd64 /bin/sh -c echo "ServerName localhost" >> /etc/apache2/apache2.conf && echo "ServerTokens Prod" >> /etc/apache2/apache2.conf && echo "ServerSignature Off" >> /etc/apache2/apache2.conf && a2dismod mpm_event && a2dissite 000-default && a2enmod mpm_prefork && a2enmod rewrite && a2enmod remoteip && a2enmod setenvif && a2enmod headers && a2enmod expires && a2enmod deflate && a2ensite site # buildkit |
| COPY apache/apache2-foreground /usr/local/bin/apache2-foreground # buildkit |
| RUN |2 PHP_VERSION=8.1 TARGETARCH=amd64 /bin/sh -c chmod +x /usr/local/bin/apache2-foreground # buildkit |
| WORKDIR /var/www/html |
| EXPOSE [80/tcp] |
| STOPSIGNAL SIGWINCH |
| CMD ["apache2-foreground"] |