FROM composer
WORKDIR /app

COPY www/composer.* .
RUN composer install

FROM php:apache
WORKDIR /var/www/html

COPY --from=0 /app/ ./
RUN chmod -R a+r ./vendor

RUN a2enmod rewrite
RUN a2enmod headers
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli

RUN mkdir raw

COPY www/ .
RUN chmod -R a+rw $(ls -I vendor)
