FROM php:cli AS build WORKDIR /flarum/app RUN apt-get update && apt-get install -y git zip unzip p7zip RUN cd /tmp \ && curl --progress-bar http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ && chmod +x /usr/local/bin/composer RUN composer create-project flarum/flarum /flarum/app FROM php:apache WORKDIR /flarum/app ENV APACHE_DOCUMENT_ROOT /flarum/app/public RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf RUN sed -ri -e 's!AllowOverride [Nn]one!AllowOverride All!' /etc/apache2/sites-available/*.conf RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" RUN a2enmod rewrite RUN apt-get update \ && apt-get install -y gettext libfreetype-dev libjpeg62-turbo-dev libpng-dev libpq5 libpq-dev mariadb-client libyaml-0-2 libyaml-dev \ && pecl install yaml \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-configure pgsql --with-pgsql=/usr/local/pgsql \ && docker-php-ext-install -j$(nproc) gd pdo pdo_mysql pdo_pgsql pgsql \ && docker-php-ext-enable gd pdo pdo_mysql pdo_pgsql pgsql yaml \ && apt-get autoremove --purge -y libpq-dev libyaml-dev \ && apt-get clean COPY docker/make_config.php /flarum/make_config.php COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh COPY --from=build /flarum/app /flarum/app RUN chown -R www-data:www-data /flarum RUN chmod a+x /usr/local/bin/docker-entrypoint.sh VOLUME /flarum/app/extensions /flarum/app/public/assets /flarum/app/storage/logs ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] CMD ["apache2-foreground"]