FROM php:8.1.3-apache

# Install modules
RUN apt-get update \ 
    && apt-get install -y zlib1g zlib1g-dev libpq-dev libpq5 libzip-dev zip unzip jq \
    && docker-php-ext-install pgsql pdo_pgsql zip bcmath sockets
    
# Install pecl modules
RUN pecl install xdebug && rm -rf /tmp/pear
RUN printf "\n" | pecl install apcu

RUN touch /var/log/xdebug_remote.log && chown www-data:www-data /var/log/xdebug_remote.log

# Install mod_rewrite
RUN a2enmod rewrite

COPY ./vhost.conf /etc/apache2/sites-available/000-default.conf

WORKDIR /project

CMD ["apache2-foreground"]