FROM php:8.1-apache


RUN apt update -y && apt install -y zip wget libbz2-dev libcurl4-openssl-dev zlib1g-dev libpng-dev libicu-dev libonig-dev libxslt-dev



ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN chmod +x /usr/local/bin/install-php-extensions && \
    install-php-extensions pdo_mysql bz2 curl fileinfo gd intl mbstring mysqli xsl

RUN curl -sSk https://getcomposer.org/installer | php -- --disable-tls && \
   mv composer.phar /usr/local/bin/composer



COPY . /var/www/

COPY ./docker/apache.conf /etc/apache2/sites-available/000-default.conf

RUN chown -R www-data:www-data /var/www

USER www-data

RUN cd /var/www && \
    composer install
WORKDIR /var/www/

ENTRYPOINT ["bash", "./docker/docker.sh"]

EXPOSE 80