1+ # Normal Operations for setup of Apache and ENV Vars
2+ FROM --platform=linux/amd64 php:8.4-apache
3+
4+ # Configure OPCache
5+ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=0
6+ ENV PHP_OPCACHE_MAX_ACCELERATED_FILES=10000
7+ ENV PHP_OPCACHE_MEMORY_CONSUMPTION=192
8+ ENV PHP_OPCACHE_MAX_WASTED_PERCENTAGE=10
9+
10+ COPY common/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
11+
12+ RUN apt-get update -y; \
13+ apt-get install -y openssl zip unzip git wget iputils-ping libpng-dev libzip-dev libmagickwand-dev --no-install-recommends; \
14+ docker-php-ext-install gd zip pdo mysqli pdo_mysql opcache; \
15+ pecl install redis; \
16+ pecl install imagick; \
17+ docker-php-ext-enable redis; \
18+ docker-php-ext-enable imagick; \
19+ apt autoremove -y; \
20+ curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer; \
21+ rm -rf /var/lib/apt/lists/*;
22+
23+
24+ # As needed for Chrome to Run
25+ # https://github.com/beganovich/snappdf#downloading-local-chromium
26+ # https://github.com/beganovich/snappdf?tab=readme-ov-file#headless-chrome-doesnt-launch-on-unix
27+ RUN apt-get update -y; \
28+ apt-get install -y ca-certificates fonts-liberation libnss3 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release xdg-utils --no-install-recommends; \
29+ rm -rf /var/lib/apt/lists/*;
30+
31+ # Configure Apache
32+ # - Enables Modrerite
33+ # - Enables RemoteIP (Used for Load Balancer and RProxies)
34+ # - Allow htaccess overrides
35+ # - Changes Listen port to 8181
36+ # - Hides Apache Server Version Information
37+ # - Load Module RemoteIP
38+ # - Reconfigure Logging to include X-Forward-For Header
39+ RUN a2enmod rewrite
40+ RUN a2enmod remoteip
41+ RUN touch /etc/apache2/conf-available/remoteip.conf
42+ RUN ln -s /etc/apache2/conf-available/remoteip.conf /etc/apache2/conf-enabled/remoteip.conf
43+
44+ COPY common/remoteip-env /usr/sbin
45+ COPY common/remoteip-clear /usr/sbin
46+ RUN chmod +x /usr/sbin/remoteip-*
47+
48+ RUN sed -ri -e 's!AllowOverride None!AllowOverride All!g' /etc/apache2/apache2.conf
49+ RUN sed -ri -e 's!Listen 80!Listen 8181!g' /etc/apache2/ports.conf
50+ RUN sed -ri -e 's!VirtualHost \*:80!VirtualHost \*:8181!g' /etc/apache2/sites-enabled/000-default.conf
51+ RUN echo "ServerSignature off" >> /etc/apache2/apache2.conf
52+ RUN echo "ServerTokens Prod" >> /etc/apache2/apache2.conf
53+
54+ RUN sed -ri -e 's!#LoadModule remoteip_module!LoadModule remoteip_module!g' /etc/apache2/apache2.conf
55+ RUN sed -ri -e 's/LogFormat .* combined/LogFormat \"%a %{c}a %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\" %I %O\" combined/g' /etc/apache2/apache2.conf
56+
57+ EXPOSE 8181
0 commit comments