FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

# Install Apache and the modules needed for PHP-FPM proxying
RUN apt-get update && \
    apt-get install -y apache2 libapache2-mod-fcgid curl && \
    a2enmod proxy_fcgi rewrite && \
    rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /var/www

# Remove the default Apache site
RUN rm -rf /var/www/html

# Copy in a custom Apache site config (to be created below)
COPY docker/ubuntu/000-default.conf /etc/apache2/sites-available/000-default.conf

# Expose port 80 for HTTP
EXPOSE 80

# Run Apache in the foreground
CMD ["apache2ctl", "-D", "FOREGROUND"]
