Dockerfile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # Use the official PHP image with Apache 7.4
  2. FROM php:7.4-apache
  3. LABEL Maintainer="kerstin Sieren <kerstin@sieren.biz>" \
  4. Description="Lightweight container with Apache & PHP-FPM based on Debian Buster."
  5. # Install required system packages and PHP extensions
  6. RUN apt-get update && apt-get install -y \
  7. libzip-dev \
  8. libfreetype6-dev \
  9. libjpeg62-turbo-dev \
  10. libpng-dev \
  11. libonig-dev \
  12. libxml2-dev \
  13. libssl-dev \
  14. libxslt1-dev \
  15. libicu-dev \
  16. libpq-dev \
  17. wget \
  18. unzip \
  19. git \
  20. && docker-php-ext-configure gd --with-freetype --with-jpeg \
  21. && docker-php-ext-install -j$(nproc) gd \
  22. && docker-php-ext-install mysqli pdo pdo_mysql mbstring zip xml opcache soap intl xsl
  23. # Install the MongoDB extension
  24. RUN pecl install mongodb \
  25. && docker-php-ext-enable mongodb
  26. # Configure PHP
  27. RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
  28. && echo 'always_populate_raw_post_data = -1\nmax_execution_time = 240\nmax_input_vars = 1500\nupload_max_filesize = 32M\npost_max_size = 32M' > $PHP_INI_DIR/conf.d/typo3.ini
  29. # Enable Apache modules
  30. RUN a2enmod proxy_fcgi setenvif rewrite
  31. # Modify the document root in 000-default.conf
  32. RUN sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/html/public|g' /etc/apache2/sites-available/000-default.conf \
  33. && sed -i 's|<Directory /var/www/html>|<Directory /var/www/html/public>|g' /etc/apache2/sites-available/000-default.conf
  34. # Set ServerName directive
  35. RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
  36. # Grant Apache permission to bind to ports 80 and 443
  37. RUN apt-get install -y libcap2-bin \
  38. && setcap 'cap_net_bind_service=+ep' /usr/sbin/apache2
  39. # Install Composer
  40. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  41. # Expose HTTP and HTTPS ports
  42. EXPOSE 80 443
  43. # Set the working directory
  44. WORKDIR /var/www/html
  45. # Start Apache in the foreground
  46. CMD ["apache2-foreground"]