FROM dunglas/frankenphp:php8.4-alpine

WORKDIR /app


RUN install-php-extensions \
    pdo_pgsql \
    opcache \
    pcntl \
    zip \
    intl


COPY --from=composer:2 /usr/bin/composer /usr/bin/composer


COPY composer.json composer.lock ./

RUN composer install \
    --no-dev \
    --no-interaction \
    --prefer-dist \
    --optimize-autoloader \
    --no-scripts


COPY . .


RUN composer dump-autoload --optimize



RUN chown -R www-data:www-data storage bootstrap/cache


COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh


EXPOSE 8000

ENTRYPOINT ["/entrypoint.sh"]
