FROM php:8.3-fpm-alpine
ENV COMPOSER_ALLOW_SUPERUSER=1

# Install PHP extensions
RUN docker-php-ext-install pdo mysqli pdo_mysql opcache

# Install Zip and more extension
RUN apk add --no-cache bash libzip-dev zip unzip
RUN docker-php-ext-install zip

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

# Install bash
RUN apk add --no-cache bash git jq moreutils openssh rsync yq

ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions
RUN install-php-extensions sockets

# Generate SSH keys
RUN ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N ""

# Optionally, copy public key to a specific location
RUN cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys

# Expose any ports you may need
EXPOSE 9000

# Command to run the PHP-FPM server
CMD ["php-fpm"]
