# Auto-generated by Shiplet
# Language: PHP 8.3  Template: laravel
ARG PHP_VERSION=8.3
FROM php:8.3-fpm-bookworm

ARG TZ=UTC
ENV TZ=${TZ} DEBIAN_FRONTEND=noninteractive

# System dependencies
RUN apt-get update -y \
    && apt-get install -y --no-install-recommends \
    curl git unzip zip libzip-dev libpng-dev libjpeg-dev \
    libfreetype6-dev libpq-dev libonig-dev libxml2-dev \
    libicu-dev libmagickwand-dev ca-certificates tzdata \
    supervisor procps \
    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
    && echo "$TZ" > /etc/timezone \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# PHP core extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg 2>/dev/null || docker-php-ext-configure gd \
    && docker-php-ext-install -j$(nproc) \
    pdo \
    pdo_mysql \
    pdo_pgsql \
    gd \
    zip \
    bcmath \
    opcache \
    pcntl \
    mbstring \
    xml \
    intl \
    exif
# PECL extensions
RUN pecl install redis \
    && docker-php-ext-enable redis

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

# PHP config
COPY .shiplet/php/php.ini ${PHP_INI_DIR}/conf.d/99-shiplet.ini
# Supervisor config for Laravel queues + scheduler
COPY .shiplet/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Laravel artisan completion
RUN echo 'alias art="php artisan"' >> /root/.bashrc
WORKDIR /var/www/html

CMD ["php-fpm"]
