# Use the official PHP image
FROM php:8.1-apache

# Set the working directory
WORKDIR /var/www/html

# Install dependencies
RUN apt-get update && apt-get install -y \
    git \
    unzip \
    libzip-dev \
    net-tools \
    iputils-ping \
    vim \
    libfreetype-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    wget \
    libicu-dev \
    && docker-php-ext-install zip pdo_mysql mysqli gd bcmath intl

RUN echo 'memory_limit = 2048M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini;

RUN a2enmod rewrite

RUN pecl install xdebug && docker-php-ext-enable xdebug

RUN docker-php-ext-configure opcache --enable-opcache \
    && docker-php-ext-install opcache

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN echo 'alias drush="/var/www/html/vendor/drush/drush/drush"' >> /root/.bashrc

# Expose port 9000 and start php-fpm server
EXPOSE 80
