# Use the latest Debian image
FROM debian:latest

# Install Apache2 and PHP 7.4 from a custom repository
RUN apt-get update && \
    apt-get install -y apache2 && \
    apt-get install -y wget lsb-release apt-transport-https ca-certificates && \
    wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
    echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && \
    apt-get update && \
    apt-get install -y php7.4 php7.4-curl php7.4-dom php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-xml php7.4-zip && \
    apt-get install -y vim && \
    apt-get clean

# Create directory for logs (optional, but recommended)
RUN mkdir -p /var/log/apache2

# Expose port 80 (default for HTTP traffic)
EXPOSE 80

COPY wordpress /var/www/html/wordpress

# Start Apache in the foreground (ensures container keeps running)
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]

