# Sahi — application image.
# Deliberately plain: PHP with Apache, three extensions, no build step, nothing
# to compile. The same image runs on a hospital's own hardware and on a VPS.

FROM php:8.3-apache

RUN docker-php-ext-install pdo_mysql \
 && a2enmod rewrite headers \
 && printf '<Directory /var/www/html>\n  AllowOverride All\n</Directory>\n' \
      > /etc/apache2/conf-available/sahi.conf \
 && a2enconf sahi

COPY server/ /var/www/html/
COPY deploy/config.docker.php /var/www/html/config.php

RUN chown -R www-data:www-data /var/www/html

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \
  CMD php -r 'exit(extension_loaded("pdo_mysql") ? 0 : 1);'
