# Utilisez l'image officielle PHP 7.4 CLI depuis Docker Hub
# Initial build for CI/CD pipeline
FROM php:7.4-cli

# Mettre à jour les paquets et installer les dépendances nécessaires
RUN apt-get update && apt-get install -y \
    unzip \
    libonig-dev \
    libzip-dev \
    zip \
    git \
    wget \
    openssh-client \
    sshpass \
    && docker-php-ext-install mbstring pdo pdo_mysql

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

# Définir le répertoire de travail
WORKDIR /app

# Copier les fichiers du projet dans le conteneur
ADD . /app

# Installer les dépendances du projet
RUN composer install

# Installer PHPUnit
RUN wget -O phpunit https://phar.phpunit.de/phpunit-9.5.phar && chmod +x phpunit && mv phpunit /usr/local/bin/phpunit
# Rendre le script PHPUnit exécutable
RUN chmod +x /usr/local/bin/phpunit

# Commande par défaut lors du démarrage du conteneur
CMD ["tail", "-f", "/dev/null"]