FROM php:8.2-apache as base
# Installation de dépendances nécessaires pour Composer
RUN apt-get update && apt-get install -y \
    git \
    unzip

# Installation de Composer

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

RUN docker-php-ext-install pdo pdo_mysql

# Copy configs
COPY ./config/virtual-host.conf /etc/apache2/sites-available/000-default.conf

# Setup App
RUN mkdir -p /app/public && chown -R www-data:www-data /app

WORKDIR /app

# add sources code
COPY . /app

ENV VOLUME_PATH /app/public

RUN composer install

EXPOSE 80

CMD ["apache2-foreground"]