Skip to content

Commit

Permalink
Added Docker PHP image 7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
trants committed Mar 7, 2024
1 parent 0a70f55 commit 3fe8c9c
Show file tree
Hide file tree
Showing 7 changed files with 602 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/.build-php-7.4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker PHP 7.4 Image CI

on:
push:
branches:
- main
paths:
- 'images/php/7.4/**'

jobs:
docker-build-php-74:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_REGISTRY_TOKEN }}

- name: Builds and pushes Docker image
uses: docker/build-push-action@v5
with:
context: images/php/7.4
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ secrets.DOCKER_PHP_IMAGE }}:7.4
cache-from: type=gha
cache-to: type=gha,mode=max
99 changes: 99 additions & 0 deletions images/php/7.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
FROM php:7.4-fpm-bullseye
LABEL maintainer="Hi-Technix, Inc. <support@hitechnix.com>"

ARG APP_ID=1000

RUN groupadd -g "$APP_ID" app \
&& useradd -g "$APP_ID" -u "$APP_ID" -d /var/www -s /bin/bash app

RUN mkdir -p /etc/nginx/html /var/www /sock \
&& chown -R app:app /etc/nginx /var/www /usr/local/etc/php/conf.d /sock

RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -

RUN apt-get update && apt-get install -y \
cron \
default-mysql-client \
git \
gnupg \
gzip \
libbz2-dev \
libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libmagickwand-dev \
libmcrypt-dev \
libonig-dev \
libpng-dev \
libsodium-dev \
libssh2-1-dev \
libwebp-dev \
libxslt1-dev \
libzip-dev \
lsof \
mailutils \
msmtp \
nodejs \
procps \
vim \
zip \
&& rm -rf /var/lib/apt/lists/*

RUN pecl channel-update pecl.php.net && pecl install \
imagick \
redis \
ssh2-1.3.1 \
&& pecl clear-cache \
&& rm -rf /tmp/pear

RUN docker-php-ext-configure \
gd --with-freetype --with-jpeg --with-webp \
&& docker-php-ext-install \
bcmath \
bz2 \
calendar \
exif \
gd \
gettext \
intl \
mbstring \
mysqli \
opcache \
pcntl \
pdo_mysql \
soap \
sockets \
sodium \
sysvmsg \
sysvsem \
sysvshm \
xsl \
zip \
&& docker-php-ext-enable \
imagick \
redis \
ssh2


RUN version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& architecture=$(uname -m) \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/$architecture/$version \
&& mkdir -p /tmp/blackfire \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
&& mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
&& rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz

RUN curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer

COPY ./conf/blackfire.ini $PHP_INI_DIR/conf.d/blackfire.ini
COPY ./conf/msmtprc /etc/msmtprc
COPY ./conf/php-fpm.conf /usr/local/etc/
COPY ./conf/php.ini $PHP_INI_DIR
COPY ./conf/www.conf /usr/local/etc/php-fpm.d/

USER app:app

VOLUME /var/www

WORKDIR /var/www
2 changes: 2 additions & 0 deletions images/php/7.4/conf/blackfire.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extension = blackfire.so
blackfire.agent_socket = tcp://blackfire:8307
4 changes: 4 additions & 0 deletions images/php/7.4/conf/msmtprc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
account default
host mailcatcher
port 1025
from "user@domain.com"
31 changes: 31 additions & 0 deletions images/php/7.4/conf/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
; This file was initially adapated from the output of: (on PHP 5.6)
; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default

[global]

error_log = /proc/self/fd/2
daemonize = no

[www]

; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2

;user = app
;group = app

listen = /sock/docker.sock
listen.owner = app
listen.group = app
listen.mode = 0660

pm = dynamic
pm.max_children = 10
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 6

clear_env = no

; Ensure worker stdout and stderr are sent to the main error log.
catch_workers_output = yes
15 changes: 15 additions & 0 deletions images/php/7.4/conf/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
memory_limit = 8G
max_execution_time = 1800
zlib.output_compression = On
cgi.fix_pathinfo = 0
date.timezone = UTC

xdebug.mode = off
xdebug.client_host = host.docker.internal
xdebug.idekey = PHPSTORM

upload_max_filesize = 1000M
post_max_size = 1000M
max_input_vars = 10000

sendmail_path = "/usr/bin/msmtp -t"
Loading

0 comments on commit 3fe8c9c

Please sign in to comment.