# Use the official PHP image with Apache
FROM php:8-apache
LABEL maintainer="craig@k5n.us"
LABEL vendor="k5n.us"

# Install mysqli extension
RUN docker-php-ext-install mysqli

# Install PosgreSQL extension and dependencies
RUN apt-get update && apt-get install -y libpq-dev \
    && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
    && docker-php-ext-install pgsql pdo_pgsql

# Install GD extension and its dependencies
RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
    && docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd

# Set working directory
WORKDIR /var/www/html

# Start Apache server in the foreground
CMD ["apache2-foreground"]
