FROM php:8.2.4-fpm

EXPOSE 9000
WORKDIR /var/www

RUN apt-get update && apt-get install -y \
        curl \
        wget \
        less \
        vim \
        git \
        libpq-dev \
        nginx

RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
RUN rm -f /usr/local/etc/php/php.ini-development
RUN rm /etc/apt/preferences.d/no-debian-php

RUN docker-php-ext-install exif
RUN docker-php-ext-install fileinfo

COPY code/ /var/www

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

# Configure Xdebug
#RUN pecl install xdebug
#RUN docker-php-ext-enable xdebug
#COPY docker/php/php.ini /usr/local/etc/php/
#COPY docker/php/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

COPY start.sh /home/start.sh

#nginx
ADD docker/nginx/default.conf /etc/nginx/conf.d/default.conf
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf
RUN chmod -R 777 /var/www/storage/*

CMD ["/bin/bash","/home/start.sh"]