Skip to content

Commit

Permalink
feat: BL-17333 - Dockerfile and resources for Apache PHP 8.2, base im…
Browse files Browse the repository at this point in the history
…age only (#42)

* Dockerfile and resources for apache php8.3

* filename uppercased

* force commit change filename

* remove filename typo to reprompt gha job

* repush failed run

* add apache proxy files and sysconfig

* lint fixes

* lint fixes

* lint fixes, removing update command

* rm cache apk* to remove unneeded cache load

* finally, add package versions

* more package versions

* attempt ignore for package version until we resolve each package specifically

* nocache options

* use dockerhub alpine image

* add tailing lines, remove superfluous comment

* revert to 8.2, scale to base php image

* remove defunct zip

* php82 file name change
  • Loading branch information
CWRahien authored Aug 8, 2024
1 parent 5433185 commit 8545e46
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ jobs:
matrix:
base:
- php/8.2/fpm-nginx
- php/8.2/fpm-apache
- php/8.3/fpm-nginx
- php/8.0/cli
- php/8.2/cli
- php/8.3/cli
exclude:
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-nginx') && 'ignored' || 'php/8.2/fpm-nginx' }}
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-apache') && 'ignored' || 'php/8.2/fpm-apache' }}
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/fpm-nginx') && 'ignored' || 'php/8.3/fpm-nginx' }}
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.0/cli') && 'ignored' || 'php/8.0/cli' }}
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/cli') && 'ignored' || 'php/8.2/cli' }}
- base: ${{ github.event_name == 'schedule' || needs.release-please.outputs.release_created || contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/cli') && 'ignored' || 'php/8.3/cli' }}
uses: ./.github/workflows/docker.yaml
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ jobs:
matrix:
base:
- php/8.2/fpm-nginx
- php/8.2/fpm-apache
- php/8.3/fpm-nginx
- php/8.0/cli
- php/8.2/cli
- php/8.3/cli
exclude:
- base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-nginx') && 'ignored' || 'php/8.2/fpm-nginx' }}
- base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/fpm-apache') && 'ignored' || 'php/8.2/fpm-apache' }}
- base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/fpm-nginx') && 'ignored' || 'php/8.3/fpm-nginx' }}
- base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.0/cli') && 'ignored' || 'php/8.0/cli' }}
- base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.2/cli') && 'ignored' || 'php/8.2/cli' }}
- base: ${{ contains(needs.orchestrator.outputs.changed-directories, 'php/8.3/cli') && 'ignored' || 'php/8.3/cli' }}
uses: ./.github/workflows/docker.yaml
Expand Down
32 changes: 32 additions & 0 deletions php/8.2/fpm-apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM php:8.2-fpm-alpine3.20

# hadolint ignore=DL3018
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache \
jq \
openrc \
apache2 \
apache2-ctl \
build-base \
apache2-proxy && \
apk del php82-apache2 && \
rm /var/cache/apk/*


# (Default Virtual Host is created with Apache install)
# Disable prefork and enable event
RUN sed -ri -e 's!^LoadModule mpm_prefork_module modules/mod_mpm_prefork.so!#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so!g' /etc/apache2/httpd.conf && \
sed -ri -e 's!^#LoadModule mpm_event_module modules/mod_mpm_event.so!LoadModule mpm_event_module modules/mod_mpm_event.so!g' /etc/apache2/httpd.conf && \
sed -ri -e 's!^#LoadModule expires_module modules/mod_expires.so!LoadModule expires_module modules/mod_expires.so!g' /etc/apache2/httpd.conf && \
sed -ri -e 's!^#LoadModule rewrite_module modules/mod_rewrite.so!LoadModule rewrite_module modules/mod_rewrite.so!g' /etc/apache2/httpd.conf

# Copy Apache FPM proxy config
COPY ./php-fpm-proxy.conf /etc/apache2/conf.d/php-fpm-proxy.conf

# Apache Config file
COPY ./httpd-sysconfig /etc/sysconfig/httpd

# Apache service start script
COPY httpd-foreground /usr/local/bin/
RUN chmod +x /usr/local/bin/httpd-foreground
8 changes: 8 additions & 0 deletions php/8.2/fpm-apache/httpd-foreground
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
set -e
# (this short script is taken from the official Apache Alpine dockerfile)

# Apache gets grumpy about PID files pre-existing
rm -f /usr/local/apache2/logs/httpd.pid

exec httpd -DFOREGROUND "$@"
27 changes: 27 additions & 0 deletions php/8.2/fpm-apache/httpd-sysconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# This file can be used to set additional environment variables for
# the httpd process, or pass additional options to the httpd
# executable.
#
# Note: With previous versions of httpd, the MPM could be changed by
# editing an "HTTPD" variable here. With the current version, that
# variable is now ignored. The MPM is a loadable module, and the
# choice of MPM can be changed by editing the configuration file
# /etc/httpd/conf.modules.d/00-mpm.conf.
#

#
# To pass additional options (for instance, -D definitions) to the
# httpd binary at startup, set OPTIONS here.
#
#OPTIONS=

#
# This setting ensures the httpd process is started in the "C" locale
# by default. (Some modules will not behave correctly if
# case-sensitive string comparisons are performed in a different
# locale.)
#
LANG=C

umask 0027
3 changes: 3 additions & 0 deletions php/8.2/fpm-apache/php-fpm-proxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>

0 comments on commit 8545e46

Please sign in to comment.