Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PHP release #54

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/php-8.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
version: ['8.0']
patchVersion: [25,26,27,28,29]
patchVersion: [26,27,28,29,30]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-8.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
version: ['8.1']
patchVersion: [20,21,22,23,24]
patchVersion: [22,23,24,25,26]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-8.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
version: ['8.2']
patchVersion: [7,8,9,10,11]
patchVersion: [9,10,11,12,13]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/php-8.3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: "8.2"
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'src/8.2/**'
- '.github/workflows/php-8.2.yml'
schedule:
- cron: '00 7 * * 1'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['8.3']
patchVersion: [0]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build php image
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: openmage/php:${{ matrix.version }}.${{ matrix.patchVersion }}
context: ./src/${{ matrix.version }}/src
file: ./src/${{ matrix.version }}/src/Dockerfile
target: php
build-args: |
PHP_VERSION=${{ matrix.version }}.${{ matrix.patchVersion }}
- name: Build toolbox image
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: openmage/php:${{ matrix.version }}.${{ matrix.patchVersion }}-toolbox
context: ./src/${{ matrix.version }}/src
file: ./src/${{ matrix.version }}/src/Dockerfile
target: toolbox
build-args: |
PHP_VERSION=${{ matrix.version }}.${{ matrix.patchVersion }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ https://github.com/newrelic/newrelic-php-agent/releases
docker build -f src/7.4/src/Dockerfile -t docker.io/openmage/php:7.4.29 src/7.4/src/

# Sample building for multi arch testing and push to docker hub:
cd src/7.4/src && docker buildx create --use && docker buildx build --progress=plain --platform linux/amd64,linux/arm64 --push -t docker.io/openmage/php:7.4.29 .
cd src/8.3/src && docker buildx create --use && docker buildx build --progress=plain --platform linux/amd64,linux/arm64 --push -t docker.io/openmage/php:8.3.0 .
2 changes: 1 addition & 1 deletion src/8.1/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG PHP_PECL_REQUIREMENTS="redis igbinary"
ARG PHP_CONFIGURE_ARGS="--enable-soap --enable-intl"
ARG PHP_CONFIGURE_ARGS_EXTRA=""
ARG PHP_CONFIGURE_ARGS_FPM="--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data"
ARG PHP_VERSION="8.1.21"
ARG PHP_VERSION="8.1.24"

ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
PHP_CPPFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
Expand Down
2 changes: 1 addition & 1 deletion src/8.2/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG PHP_PECL_REQUIREMENTS="redis igbinary"
ARG PHP_CONFIGURE_ARGS="--enable-soap --enable-intl"
ARG PHP_CONFIGURE_ARGS_EXTRA=""
ARG PHP_CONFIGURE_ARGS_FPM="--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data"
ARG PHP_VERSION="8.2.7"
ARG PHP_VERSION="8.2.11"

ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
PHP_CPPFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
Expand Down
181 changes: 181 additions & 0 deletions src/8.3/src/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
FROM openmage/php-base:bookworm-latest AS php

COPY FS /

ARG PHP_RUNTIME_REQUIREMENTS="jq curl libcurl3-gnutls ca-certificates libedit2 libgmp-dev libfreetype6 libltdl7 libmcrypt4 sqlite3 libpng16-16 libzip4 libfcgi-bin libtidy5deb1 libsodium23 libonig5 cron vim.tiny php-xdebug zip"
ARG PHP_RUNTIME_REQUIREMENTS_EXTRA=""
ARG PHP_BUILD_REQUIREMENTS="build-essential dpkg-dev automake autoconf libtool file g++ gcc libc-dev make pkg-config re2c libxml2-dev libcurl4-gnutls-dev libtidy-dev libsqlite3-dev libssl-dev libxml2-dev zlib1g-dev libpng-dev liblzf-dev libreadline6-dev libfreetype6-dev libmcrypt-dev libedit-dev libltdl-dev libxslt-dev libzip-dev libsodium-dev libonig-dev gnupg2 argon2 libargon2-0 libargon2-dev libzip-dev"
ARG PHP_BUILD_REQUIREMENTS_EXTRA=""
ARG PHP_PECL_REQUIREMENTS="redis igbinary"
ARG PHP_CONFIGURE_ARGS="--enable-soap --enable-intl"
ARG PHP_CONFIGURE_ARGS_EXTRA=""
ARG PHP_CONFIGURE_ARGS_FPM="--enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data"
ARG PHP_VERSION="8.3.0"

ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
PHP_CPPFLAGS="-fstack-protector-strong -fpic -fpie -O2" \
PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" \
PHP_VERSION="${PHP_VERSION}" \
PHP_INI_DIR="/usr/local/etc/php" \
PHP_SRC_DIR="/usr/src/php" \
PHP_SRC_FILE="/usr/src/php.tar.gz" \
PHPIZE_BUILD_REQUIREMENTS="build-essential automake autoconf libtool file g++ gcc libc-dev make pkg-config re2c libltdl-dev" \
DOCUMENT_ROOT="/var/www/html" \
PHP_URL="https://www.php.net/distributions/php-${PHP_VERSION}.tar.xz" \
IMAGICK_VERSION="3.7.0"

### configure php
# hadolint ignore=DL4006,SC2039,DL3003
RUN set -xe; \
\
chmod 755 /usr/local/bin/docker-entrypoint; \
/usr/local/bin/docker-install-requirements php; \
ln -fs /etc/alternatives/vi /usr/bin/vim; \
mkdir -p /tmp/mhsendmail; \
cd /tmp/mhsendmail; \
curl -LkSso /usr/local/bin/mhsendmail 'https://github.com/mailhog/mhsendmail/releases/download/v0.2.0/mhsendmail_linux_amd64'&& \
chmod 0755 /usr/local/bin/mhsendmail; \
chmod +x /usr/local/bin/mhsendmail; \
mkdir -p "${PHP_INI_DIR}/conf.d"; \
mkdir -p /usr/src; \
cd /usr/src; \
curl -fsSL -o php.tar.xz "$PHP_URL"; \
docker-php-source extract; \
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
if [[ ! -d "/usr/include/curl" ]]; then \
ln -sT "/usr/include/${debMultiarch}/curl" /usr/local/include/curl; \
fi; \
cd /usr/src/php; \
export \
CFLAGS="$PHP_CFLAGS" \
CPPFLAGS="$PHP_CPPFLAGS" \
LDFLAGS="$PHP_LDFLAGS" \
; \
./configure \
--build="$gnuArch" \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
--enable-option-checking=fatal \
--disable-cgi \
--with-pdo-mysql=mysqlnd \
--enable-mysqlnd \
--with-mhash \
--enable-ftp \
--enable-mbstring \
--with-curl \
--with-libedit \
--with-openssl \
--with-zlib \
--enable-exif \
--enable-bcmath \
--enable-sockets \
--with-xsl \
--enable-pcntl \
--with-sodium \
--with-tidy \
--enable-gd \
--with-jpeg \
--with-freetype \
${PHP_CONFIGURE_ARGS:-} \
${PHP_CONFIGURE_ARGS_EXTRA:-} \
${PHP_CONFIGURE_ARGS_FPM:-} \
; \
make -j "$(nproc)"; \
make install;
RUN set -xe; \
\
mkdir -p /usr/src/php/ext/imagick; \
curl -fsSL https://github.com/Imagick/imagick/archive/refs/tags/${IMAGICK_VERSION}.tar.gz | tar xvz -C "/usr/src/php/ext/imagick" --strip 1; \
docker-php-ext-install imagick gd zip; \
curl -fsSL https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -o pickle.phar; \
chmod +x pickle.phar; \
mv pickle.phar /usr/local/bin/pickle; \
pickle install redis; \
pickle install igbinary; \
pickle install xdebug; \
docker-php-ext-enable opcache redis igbinary imagick gd; \
docker-php-source delete;
RUN set -xe; \
\
# for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf"
sed 's!=NONE/!=!g' /usr/local/etc/php-fpm.conf.default | tee /usr/local/etc/php-fpm.conf > /dev/null; \
cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf; \
{ \
echo '[global]'; \
echo 'error_log = /proc/self/fd/2'; \
echo; \
echo '[www]'; \
echo '; if we send this to /proc/self/fd/1, it never appears'; \
echo 'access.log = /proc/self/fd/2'; \
echo; \
echo 'clear_env = no'; \
echo; \
echo '; Ensure worker stdout and stderr are sent to the main error log.'; \
echo 'catch_workers_output = yes'; \
} | tee /usr/local/etc/php-fpm.d/docker.conf; \
{ \
echo '[global]'; \
echo 'daemonize = no'; \
echo; \
echo '[www]'; \
echo 'listen = 9000'; \
echo 'pm.max_children = 10'; \
echo 'pm.min_spare_servers = 2'; \
echo 'pm.max_spare_servers = 5'; \
echo 'pm.status_path = /status'; \
} | tee /usr/local/etc/php-fpm.d/zz-docker.conf; \
/usr/local/bin/docker-layer-clean

## configure php extensions
# hadolint ignore=DL4006,SC2086,DL3003
RUN set -xe; \
\
################################################
## install Composer 2 as default
################################################
COMPOSER_DOWNLOAD_LATEST=$(curl -s https://api.github.com/repos/composer/composer/releases/latest | jq --raw-output '.assets[] | .browser_download_url' | head -n 1) ; \
docker-package-download -o /usr/local/bin/composer ${COMPOSER_DOWNLOAD_LATEST}; \
chmod +x /usr/local/bin/composer; \
composer selfupdate; \
################################################
## install Composer 1
################################################
docker-package-download -o /usr/local/bin/composer1 https://getcomposer.org/composer-1.phar; \
chmod +x /usr/local/bin/composer1; \
composer1 selfupdate; \
################################################
## install magerun
################################################
curl -s -f -L -o /usr/local/bin/magerun https://files.magerun.net/n98-magerun.phar; \
chmod +x /usr/local/bin/magerun; \
################################################
## install magerun2
################################################
curl -s -f -L -o /usr/local/bin/magerun2 https://files.magerun.net/n98-magerun2.phar; \
chmod +x /usr/local/bin/magerun2; \
/usr/local/bin/docker-layer-clean

WORKDIR /var/www/html
ENTRYPOINT ["docker-entrypoint"]
CMD ["php-fpm"]
EXPOSE 9000

FROM php AS toolbox

ARG TOOLBOX_RUNTIME_REQUIREMENTS="curl git redis-tools mariadb-client percona-toolkit rsync openssh-client vim.tiny"
ARG TOOLBOX_RUNTIME_REQUIREMENTS_EXTRA=""
ARG TOOLBOX_BUILD_REQUIREMENTS=""
ARG TOOLBOX_BUILD_REQUIREMENTS_EXTRA=""

# hadolint ignore=DL4006
RUN set -xe; \
\
/usr/local/bin/docker-install-requirements toolbox; \
curl https://rclone.org/install.sh | bash; \
composer require deployer/deployer; \
composer update; \
echo "export PATH=$PATH:/var/www/html/vendor/bin" >> /etc/profile; \
/usr/local/bin/docker-layer-clean

CMD ["php", "-a"]
Loading
Loading