changed to php base

This commit is contained in:
2026-07-20 20:30:03 -07:00
parent 76fd1ca3ed
commit 0831331fe3
4 changed files with 33 additions and 42 deletions
+24 -33
View File
@@ -1,42 +1,33 @@
# Arch Linux + Apache + PHP image for running novaconium in production.
# Official PHP + Apache image for running novaconium in production.
# See /admin/docs/docker for the bind-mounted paths, docker-entrypoint.sh's
# seeding/permissions behavior, and optional MySQL wiring.
FROM archlinux:base
# Arch's repos are rolling-release with no version-pinned packages, so
# `pacman -S apache=X.Y` isn't reliably available — point pacman at a dated
# Arch Linux Archive (https://archive.archlinux.org) snapshot instead of the
# live mirror so a rebuild months from now installs the same Apache/PHP/
# SQLite versions instead of whatever happens to be current that day. Bump
# ARCH_SNAPSHOT deliberately (e.g. to pick up a PHP security release), not
# as a side effect of an unrelated rebuild.
ARG ARCH_SNAPSHOT=2026/07/01
RUN echo "Server=https://archive.archlinux.org/repos/${ARCH_SNAPSHOT}/\$repo/os/\$arch" \
> /etc/pacman.d/mirrorlist
# Build: docker build --no-cache -t novaconium:latest .
RUN pacman -Syyu --noconfirm --needed apache php php-apache php-sqlite \
&& pacman -Scc --noconfirm
# Fixed: full official image tag (was missing "php:")
FROM php:8.5.8-apache-trixie
# php-apache on Arch is built against mpm_prefork, not httpd's default
# mpm_event — swap MPMs, enable mod_rewrite, point DocumentRoot at
# public/, and wire in mod_php.
RUN sed -i \
-e 's/^LoadModule mpm_event_module/#LoadModule mpm_event_module/' \
-e 's/^#LoadModule mpm_prefork_module/LoadModule mpm_prefork_module/' \
-e '/^#LoadModule rewrite_module/s/^#//' \
-e 's#DocumentRoot "/srv/http"#DocumentRoot "/var/www/html/public"#' \
-e 's#<Directory "/srv/http">#<Directory "/var/www/html/public">#' \
-e 's/^\( *\)AllowOverride None$/\1AllowOverride All/' \
/etc/httpd/conf/httpd.conf \
&& printf '\nLoadModule php_module modules/libphp.so\nAddHandler php-script .php\nDirectoryIndex index.php index.html\nServerName localhost\n' \
>> /etc/httpd/conf/httpd.conf \
&& sed -i \
-e 's/^;extension=pdo_sqlite/extension=pdo_sqlite/' \
-e 's/^;extension=pdo_mysql/extension=pdo_mysql/' \
/etc/php/php.ini
# Pin to a specific tag (not a floating "php:apache") so a rebuild months
# from now installs the same PHP/Apache/Debian base instead of whatever
# happens to be current that day. Bump the tag above deliberately (e.g. to
# pick up a PHP security release), not as a side effect of an unrelated
# rebuild.
RUN apt-get update \
&& apt-get install -y --no-install-recommends libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install pdo_sqlite pdo_mysql \
&& a2enmod rewrite
# Point DocumentRoot at public/ and allow .htaccess overrides there.
RUN sed -ri -e 's#/var/www/html#/var/www/html/public#g' \
/etc/apache2/sites-available/*.conf \
&& sed -ri -e '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' \
/etc/apache2/apache2.conf
WORKDIR /var/www/html
# Copy application files
COPY novaconium/ ./novaconium/
COPY public/ ./public/
COPY App/ ./App/
@@ -53,7 +44,7 @@ RUN cp -a App/ /opt/novaconium-app-default/
# container with no bind mounts configured at all.
RUN mkdir -p public/cache public/uploads data \
&& touch novaconium/contact-log.txt \
&& chown -R http:http public/cache public/uploads data App novaconium/contact-log.txt
&& chown -R www-data:www-data public/cache public/uploads data App novaconium/contact-log.txt
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
@@ -61,4 +52,4 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["httpd", "-D", "FOREGROUND"]
CMD ["apache2-foreground"]