FROM php:8.5-apache

# Install common extensions (example)
# RUN docker-php-ext-install

# Enable Apache modules if needed
RUN a2enmod rewrite

# Copy application code
COPY . /var/www/html/

# Disable the legacy HTTPS redirect rules from .htaccess so the container stays on plain HTTP
# RUN sed -i '/RewriteCond %{HTTP_HOST} !^www\\.dialyse-berlin\\.net  \[NC\]/,+2d; /RewriteCond %{HTTP_HOST} ^www\\.dialyse-berlin\\.net  \[NC\]/,+2d' /var/www/html/.htaccess || true \
#    && a2dismod ssl || true

# Set permissions
RUN chown -R www-data:www-data /var/www/html

# Optional: install Composer dependencies if you have a composer.json
# COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# RUN composer install --no-dev --optimize-autoloader

EXPOSE 80