FROM php:8.2-fpm

# Installation des dépendances système
RUN apt-get update && apt-get install -yqq --no-install-recommends \
    apt-utils gnupg git build-essential openssh-client zip \
    unzip zlib1g-dev libicu-dev g++ libzip-dev libpng-dev libtidy-dev libssl-dev \
    libxslt-dev libxrender-dev libxrender1 libxt6 libxtst6 openssh-server \
    xorg iputils-ping wget gdebi ca-certificates wget \
    fontconfig acl procps libmagickwand-dev imagemagick \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Installation des extensions PHP
RUN docker-php-ext-install intl zip xsl \
    && pecl install xdebug imagick \
    && docker-php-ext-enable xdebug imagick

# Configure docker
#docker-php-ext-configure intl
#docker-php-ext-install intl opcache pdo_mysql exif bcmath calendar gd tidy
#docker-php-ext-enable libxslt-dev
#docker-php-ext-enable intl
#docker-php-ext-enable exif
#docker-php-ext-enable tidy
#docker-php-ext-install zip
#docker-php-ext-install xsl
#pecl install apcu-5.1.21

# Configuration SSH
RUN mkdir -p /root/.ssh && \
    chmod 700 /root/.ssh && \
    echo "StrictHostKeyChecking no" >> /root/.ssh/config

# Installation de Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Configuration PHP
RUN echo "memory_limit=2096M" > /usr/local/etc/php/conf.d/memory-limit.ini

# Configuration Git
RUN git config --global user.email "exploitation@opentalent.fr" && \
    git config --global user.name "git"


WORKDIR /app

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

ENTRYPOINT ["/entrypoint.sh"]

