Jeroen De Meerleer
121be9b5ef
- Changed document root variable to WEBSITE_ROOT - Updated configuration files to reflect new path - Set ownership of the website directory to www-data - Adjusted .env file renaming to use the new root variable
42 lines
1.5 KiB
Docker
42 lines
1.5 KiB
Docker
FROM php:8.3-apache AS runtime
|
|
|
|
ENV APACHE_DOCUMENT_ROOT=/var/www/website/public/
|
|
ENV WEBSITE_ROOT=/var/www/website/
|
|
ENV TZ=Europe/Brussels
|
|
ENV COMPOSER_ALLOW_SUPERUSER=1
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
COPY . ${WEBSITE_ROOT}
|
|
|
|
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 a2enmod rewrite
|
|
|
|
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin
|
|
RUN set -eux; \
|
|
chmod uga+x /usr/local/bin/install-php-extensions && sync
|
|
|
|
RUN set -eux;install-php-extensions intl zip
|
|
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
|
RUN printf "[PHP]\ndate.timezone = \"$TZ\"\n" > /usr/local/etc/php/conf.d/tzone.ini
|
|
|
|
COPY docker-resources/apache2-foreground /usr/local/bin/apache2-foreground
|
|
COPY docker-resources/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
|
|
RUN set -eux; \
|
|
chmod uga+x /usr/local/bin/entrypoint.sh && \
|
|
chmod uga+x /usr/local/bin/apache2-foreground && sync
|
|
|
|
RUN chown -R www-data:www-data ${WEBSITE_ROOT}
|
|
USER www-data
|
|
|
|
WORKDIR ${WEBSITE_ROOT}
|
|
RUN mv ${WEBSITE_ROOT}.env.sample ${WEBSITE_ROOT}.env
|
|
RUN composer install
|
|
RUN php bin/console asset-map:compile
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|