FROM php:8.1-cli

RUN apt-get update && apt-get install -y --no-install-recommends \
    libpng-dev libjpeg-dev libfreetype6-dev libzip-dev libonig-dev \
    libcurl4-openssl-dev libssl-dev unzip \
    && rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) pdo_mysql mysqli pcntl posix gd zip bcmath mbstring

RUN pecl install redis && docker-php-ext-enable redis

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

COPY . /app
WORKDIR /app

RUN composer install --no-dev --optimize-autoloader --no-interaction

EXPOSE 36300 36301 36302

CMD ["php", "start.php", "start"]
