FROM php:8.0-apache


RUN apt-get update


RUN apt-get install -y \
    libfreetype6-dev \
    libjpeg62-turbo-dev \
    libpng-dev \
    libzip-dev \
    git \
    unzip \
    libpq-dev


RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
    && docker-php-ext-install -j$(nproc) gd pdo pdo_mysql pdo_pgsql zip


RUN apt-get clean


COPY apache.conf /etc/apache2/sites-available/000-default.conf


RUN a2enmod rewrite


COPY . /app


WORKDIR /app


RUN chown -R www-data:www-data /app/backend/web/assets /app/backend/runtime \
    && chmod -R 775 /app/backend/web/assets /app/backend/runtime


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


RUN COMPOSER_ALLOW_SUPERUSER=1 composer install


EXPOSE 80


CMD ["apache2-foreground"]
 
