Files
novaconium/Dockerfile
T
2026-07-20 20:30:03 -07:00

55 lines
2.2 KiB
Docker

# 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.
# Build: docker build --no-cache -t novaconium:latest .
# Fixed: full official image tag (was missing "php:")
FROM php:8.5.8-apache-trixie
# 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/
# Pristine copy of the starter App/, kept outside /var/www/html so
# docker-entrypoint.sh can reseed a bind-mounted (but empty/missing) App/ on
# first start — see docker-entrypoint.sh and /admin/docs/docker.
RUN cp -a App/ /opt/novaconium-app-default/
# Runtime-writable paths — cache/uploads/App/data are bind-mounted from the
# host by docker-compose.yml, so docker-entrypoint.sh re-chowns them at
# every container start (a build-time chown only survives on the image
# layer, not on a host bind mount). This chown still covers a fresh
# container with no bind mounts configured at all.
RUN mkdir -p public/cache public/uploads data \
&& touch 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
EXPOSE 80
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apache2-foreground"]