FROM php:8.2

ENV TZ=Asia/Jakarta
RUN apt-get update -y && apt-get install -y openssl zip unzip git

RUN apt-get update && apt-get install -y libpq-dev libzip-dev libpng-dev
RUN docker-php-ext-install bcmath gd zip pdo pdo_pgsql mysqli pdo_mysql \
    && docker-php-ext-enable pdo_mysql  pdo_pgsql
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN php -m | grep mbstring

WORKDIR /app
RUN chmod -R 777 /app
# RUN chmod -R 777 storage
# RUN chmod -R 777 bootstrap
# RUN chmod -R 777 resources
COPY --chown=www-data:www-data ./src/ .
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install
# RUN composer require maatwebsite/excel
RUN chmod -R 777 /app/storage/
RUN chmod -R 777 /app/bootstrap/
RUN chmod -R 777 /app/resources/

CMD php artisan serve --host=0.0.0.0 --port=8000
EXPOSE 8000