|
@@ -1,45 +1,50 @@
|
|
|
-FROM php:7.4-apache-buster
|
|
|
|
|
|
|
+# Use the official PHP image with Apache 7.4
|
|
|
|
|
+FROM php:7.4-apache
|
|
|
|
|
|
|
|
LABEL Maintainer="kerstin Sieren <kerstin@sieren.biz>" \
|
|
LABEL Maintainer="kerstin Sieren <kerstin@sieren.biz>" \
|
|
|
Description="Lightweight container with Apache & PHP-FPM based on Debian Buster."
|
|
Description="Lightweight container with Apache & PHP-FPM based on Debian Buster."
|
|
|
|
|
+# Install required system packages and PHP extensions
|
|
|
|
|
+RUN apt-get update && apt-get install -y \
|
|
|
|
|
+ libzip-dev \
|
|
|
|
|
+ libfreetype6-dev \
|
|
|
|
|
+ libjpeg62-turbo-dev \
|
|
|
|
|
+ libpng-dev \
|
|
|
|
|
+ libonig-dev \
|
|
|
|
|
+ libxml2-dev \
|
|
|
|
|
+ libssl-dev \
|
|
|
|
|
+ libxslt1-dev \
|
|
|
|
|
+ libicu-dev \
|
|
|
|
|
+ libpq-dev \
|
|
|
|
|
+ wget \
|
|
|
|
|
+ unzip \
|
|
|
|
|
+ git \
|
|
|
|
|
+ && docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
|
|
|
+ && docker-php-ext-install -j$(nproc) gd \
|
|
|
|
|
+ && docker-php-ext-install mysqli pdo pdo_mysql mbstring zip xml opcache soap intl xsl
|
|
|
|
|
+
|
|
|
|
|
+# Install the MongoDB extension
|
|
|
|
|
+RUN pecl install mongodb \
|
|
|
|
|
+ && docker-php-ext-enable mongodb
|
|
|
|
|
|
|
|
-RUN apt-get update && \
|
|
|
|
|
- apt-get upgrade -y && \
|
|
|
|
|
- apt-get install -y --no-install-recommends \
|
|
|
|
|
- wget git \
|
|
|
|
|
# Configure PHP
|
|
# Configure PHP
|
|
|
- libxml2-dev libfreetype6-dev \
|
|
|
|
|
- libjpeg62-turbo-dev \
|
|
|
|
|
- libmcrypt-dev \
|
|
|
|
|
- libpng-dev \
|
|
|
|
|
- libpq-dev \
|
|
|
|
|
- libzip-dev \
|
|
|
|
|
- zlib1g-dev \
|
|
|
|
|
-# Install required 3rd party tools
|
|
|
|
|
- graphicsmagick && \
|
|
|
|
|
-# Configure extensions
|
|
|
|
|
- docker-php-ext-configure gd --with-libdir=/usr/include/ --with-jpeg --with-freetype && \
|
|
|
|
|
- docker-php-ext-install -j$(nproc) mysqli soap gd zip opcache intl pgsql pdo_pgsql && \
|
|
|
|
|
- echo 'always_populate_raw_post_data = -1\nmax_execution_time = 240\nmax_input_vars = 1500\nupload_max_filesize = 32M\npost_max_size = 32M' > /usr/local/etc/php/conf.d/typo3.ini && \
|
|
|
|
|
-# Configure Apache as needed
|
|
|
|
|
- a2enmod rewrite && \
|
|
|
|
|
- apt-get clean && \
|
|
|
|
|
- apt-get -y purge \
|
|
|
|
|
- libxml2-dev libfreetype6-dev \
|
|
|
|
|
- libjpeg62-turbo-dev \
|
|
|
|
|
- libmcrypt-dev \
|
|
|
|
|
- libpng-dev \
|
|
|
|
|
- libzip-dev \
|
|
|
|
|
- zlib1g-dev && \
|
|
|
|
|
- rm -rf /var/lib/apt/lists/* /usr/src/* \
|
|
|
|
|
-
|
|
|
|
|
-# Add application
|
|
|
|
|
-WORKDIR /var/www/html
|
|
|
|
|
-RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
|
|
|
|
|
-RUN chown -R www-data:www-data /var/www/html
|
|
|
|
|
|
|
+RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
|
|
|
|
|
+ && 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
|
|
|
|
|
+
|
|
|
|
|
+# Enable Apache modules
|
|
|
|
|
+RUN a2enmod proxy_fcgi setenvif rewrite
|
|
|
|
|
+
|
|
|
|
|
+# Modify the document root in 000-default.conf
|
|
|
|
|
+RUN sed -i 's|DocumentRoot /var/www/html|DocumentRoot /var/www/html/public|g' /etc/apache2/sites-available/000-default.conf \
|
|
|
|
|
+ && sed -i 's|<Directory /var/www/html>|<Directory /var/www/html/public>|g' /etc/apache2/sites-available/000-default.conf
|
|
|
|
|
|
|
|
-# Expose the port apache is reachable on
|
|
|
|
|
-EXPOSE 80
|
|
|
|
|
|
|
+# Install Composer
|
|
|
|
|
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
|
|
|
+
|
|
|
|
|
+# Expose HTTP and HTTPS ports
|
|
|
|
|
+EXPOSE 80 443
|
|
|
|
|
+
|
|
|
|
|
+# Set the working directory
|
|
|
|
|
+WORKDIR /var/www/html
|
|
|
|
|
|
|
|
-# Switch to use a non-root user from here on
|
|
|
|
|
-USER www-data
|
|
|
|
|
|
|
+# Start Apache in the foreground
|
|
|
|
|
+CMD ["apache2-foreground"]
|