FROM php:8.1-apache as BASE MAINTAINER Nikurasu WORKDIR /var/www/html # set env ENV TZ Europe/Berlin ENV APACHE_PHP_MEMORY_LIMIT 500M ENV APACHE_DOCUMENT_ROOT /var/www/html/src/public # install updates, apache2 and php-extensions RUN apt-get update -y &&\ apt-get upgrade -y &&\ apt-get install -y libonig-dev RUN docker-php-ext-install bcmath # configure apache2 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 -q rewrite actions # copy source files COPY src/ /var/www/html/src RUN chown -R www-data:www-data /var/www # modify .env file RUN sed -ri -e "s/^DB_DATABASE=.*$/DB_DATABASE=\/var\/www\/html\/src\/resources\/database.db/" /var/www/html/src/.env RUN sed -ri -e "s/^JSON_FILE_PATH=.*$/JSON_FILE_PATH=\/var\/www\/html\/src\/resources\/data.json/" /var/www/html/src/.env EXPOSE 80 CMD php src/artisan preloadDB:all && apachectl -D FOREGROUND