try to make 8.3 build working by building imagick from master branch

This commit is contained in:
Christian Winther 2024-01-26 22:51:15 +00:00
parent 8bdb0ca77b
commit 1a6e97c98b
5 changed files with 28 additions and 56 deletions

View File

@ -84,10 +84,6 @@ jobs:
# See: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#excluding-matrix-configurations
# See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixexclude
exclude:
# Broken for imagick on arm64 due to https://github.com/Imagick/imagick/pull/641
# Could probably figure out how to do a matrix only ignoring 8.3 + linux/arm64, but this is easier atm
- php_version: 8.3
# targeting [apache] runtime with [fpm] base type doesn't make sense
- target_runtime: apache
php_base: fpm

View File

@ -5,7 +5,10 @@
# Configuration
#######################################################
# See: https://github.com/composer/composer/releases
# See: https://github.com/mlocati/docker-php-extension-installer
ARG DOCKER_PHP_EXTENSION_INSTALLER_VERSION="2.1.80"
# See: https://github.com/composer/composer
ARG COMPOSER_VERSION="2.6"
# See: https://nginx.org/
@ -17,7 +20,7 @@ ARG FOREGO_VERSION="0.17.2"
# See: https://github.com/hairyhenderson/gomplate
ARG GOMPLATE_VERSION="v3.11.6"
# See: https://github.com/dotenv-linter/dotenv-linter/releases
# See: https://github.com/dotenv-linter/dotenv-linter
#
# WARN: v3.3.0 and above requires newer libc version than Ubuntu ships with
ARG DOTENV_LINTER_VERSION="v3.2.0"
@ -40,7 +43,10 @@ ARG RUNTIME_GID=33 # often called 'www-data'
ARG APT_PACKAGES_EXTRA=
# Extensions installed via [pecl install]
ARG PHP_PECL_EXTENSIONS="redis imagick"
# ! NOTE: imagick is installed from [master] branch on GitHub due to 8.3 bug on ARM that haven't
# ! been released yet (after +10 months)!
# ! See: https://github.com/Imagick/imagick/pull/641
ARG PHP_PECL_EXTENSIONS="redis https://codeload.github.com/Imagick/imagick/tar.gz/28f27044e435a2b203e32675e942eb8de620ee58"
ARG PHP_PECL_EXTENSIONS_EXTRA=
# Extensions installed via [docker-php-ext-install]
@ -63,6 +69,11 @@ ARG NGINX_GPGKEY_PATH="/usr/share/keyrings/nginx-archive-keyring.gpg"
# NOTE: Docker will *not* pull this image unless it's referenced (via build target)
FROM composer:${COMPOSER_VERSION} AS composer-image
# php-extension-installer image from Docker Hub
#
# NOTE: Docker will *not* pull this image unless it's referenced (via build target)
FROM mlocati/php-extension-installer:${DOCKER_PHP_EXTENSION_INSTALLER_VERSION} AS php-extension-installer
# nginx webserver from Docker Hub.
# Used to copy some docker-entrypoint files for [nginx-runtime]
#
@ -147,23 +158,24 @@ ARG PHP_PECL_EXTENSIONS_EXTRA
ARG PHP_VERSION
ARG TARGETPLATFORM
ENV PHP_EXTENSIONS_DATABASE=${PHP_EXTENSIONS_DATABASE}
ENV PHP_EXTENSIONS_EXTRA=${PHP_EXTENSIONS_EXTRA}
ENV PHP_EXTENSIONS=${PHP_EXTENSIONS}
ENV PHP_PECL_EXTENSIONS_EXTRA=${PHP_PECL_EXTENSIONS_EXTRA}
ENV PHP_PECL_EXTENSIONS=${PHP_PECL_EXTENSIONS}
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
COPY docker/shared/root/docker/install/php-extensions.sh /docker/install/php-extensions.sh
RUN --mount=type=cache,id=pixelfed-php-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETPLATFORM},sharing=locked,target=/usr/src/php \
RUN --mount=type=cache,id=pixelfed-pear-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETPLATFORM},sharing=locked,target=/tmp/pear \
--mount=type=cache,id=pixelfed-apt-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETPLATFORM},sharing=locked,target=/var/lib/apt \
--mount=type=cache,id=pixelfed-apt-cache-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETPLATFORM},sharing=locked,target=/var/cache/apt \
PHP_EXTENSIONS=${PHP_EXTENSIONS} \
PHP_EXTENSIONS_DATABASE=${PHP_EXTENSIONS_DATABASE} \
PHP_EXTENSIONS_EXTRA=${PHP_EXTENSIONS_EXTRA} \
PHP_PECL_EXTENSIONS=${PHP_PECL_EXTENSIONS} \
PHP_PECL_EXTENSIONS_EXTRA=${PHP_PECL_EXTENSIONS_EXTRA} \
/docker/install/php-extensions.sh
#######################################################
# PHP: composer and source code
#######################################################
FROM base AS composer-and-src
FROM php-extensions AS composer-and-src
ARG PHP_VERSION
ARG PHP_DEBIAN_RELEASE
@ -188,7 +200,7 @@ USER ${RUNTIME_UID}:${RUNTIME_GID}
# Install composer dependencies
# NOTE: we skip the autoloader generation here since we don't have all files avaliable (yet)
RUN --mount=type=cache,id=pixelfed-composer-${PHP_VERSION}-${PHP_DEBIAN_RELEASE}-${TARGETPLATFORM},sharing=locked,target=/cache/composer \
RUN --mount=type=cache,id=pixelfed-composer-${PHP_VERSION},sharing=locked,target=/cache/composer \
--mount=type=bind,source=composer.json,target=/var/www/composer.json \
--mount=type=bind,source=composer.lock,target=/var/www/composer.lock \
set -ex \
@ -201,7 +213,7 @@ COPY --chown=${RUNTIME_UID}:${RUNTIME_GID} . /var/www/
# Runtime: base
#######################################################
FROM base AS shared-runtime
FROM php-extensions AS shared-runtime
ARG BUILDARCH
ARG BUILDOS
@ -212,8 +224,6 @@ ARG RUNTIME_UID
ENV RUNTIME_UID=${RUNTIME_UID}
ENV RUNTIME_GID=${RUNTIME_GID}
COPY --link --from=php-extensions /usr/local/lib/php/extensions /usr/local/lib/php/extensions
COPY --link --from=php-extensions /usr/local/etc/php /usr/local/etc/php
COPY --link --from=forego-image /usr/local/bin/forego /usr/local/bin/forego
COPY --link --from=gomplate-image /usr/local/bin/gomplate /usr/local/bin/gomplate
COPY --link --from=composer-image /usr/bin/composer /usr/bin/composer

View File

@ -7,7 +7,7 @@ source "${ENTRYPOINT_ROOT}/helpers.sh"
entrypoint-set-script-name "$0"
# Copy the [storage/] skeleton files over the "real" [storage/] directory so assets are updated between versions
run-as-runtime-user cp --recursive storage.skel/. ./storage/
run-as-runtime-user cp --force --recursive storage.skel/. ./storage/
# Ensure storage linkk are correctly configured
run-as-runtime-user php artisan storage:link

View File

@ -21,8 +21,6 @@ packages+=(
git
gnupg1
gosu
libcurl4-openssl-dev
libzip-dev
locales
locales-all
moreutils
@ -42,21 +40,6 @@ packages+=(
pngquant
)
# Image Processing
packages+=(
libjpeg62-turbo-dev
libmagickwand-dev
libpng-dev
)
# Required for GD
packages+=(
libwebp-dev
libwebp6
libxpm-dev
libxpm4
)
# Video Processing
packages+=(
ffmpeg
@ -64,8 +47,6 @@ packages+=(
# Database
packages+=(
libpq-dev
libsqlite3-dev
mariadb-client
postgresql-client
)

View File

@ -2,6 +2,7 @@
set -ex -o errexit -o nounset -o pipefail
declare -a pecl_extensions=()
readarray -d ' ' -t pecl_extensions < <(echo -n "${PHP_PECL_EXTENSIONS:-}")
readarray -d ' ' -t -O "${#pecl_extensions[@]}" pecl_extensions < <(echo -n "${PHP_PECL_EXTENSIONS_EXTRA:-}")
@ -10,16 +11,6 @@ readarray -d ' ' -t php_extensions < <(echo -n "${PHP_EXTENSIONS:-}")
readarray -d ' ' -t -O "${#php_extensions[@]}" php_extensions < <(echo -n "${PHP_EXTENSIONS_EXTRA:-}")
readarray -d ' ' -t -O "${#php_extensions[@]}" php_extensions < <(echo -n "${PHP_EXTENSIONS_DATABASE:-}")
# Grab the PHP source code so we can compile against it
docker-php-source extract
# PHP GD extensions
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
--with-xpm
# Optional script folks can copy into their image to do any [docker-php-ext-configure] work before the [docker-php-ext-install]
# this can also overwirte the [gd] configure above by simply running it again
declare -r custom_pre_configure_script=""
@ -32,11 +23,5 @@ if [[ -e "${custom_pre_configure_script}" ]]; then
"${custom_pre_configure_script}"
fi
# Install pecl extensions
pecl install "${pecl_extensions[@]}"
# PHP extensions (dependencies)
docker-php-ext-install -j "$(nproc)" "${php_extensions[@]}"
# Enable all extensions
docker-php-ext-enable "${pecl_extensions[@]}" "${php_extensions[@]}"
# PECL + PHP extensions
IPE_KEEP_SYSPKG_CACHE=1 install-php-extensions "${pecl_extensions[@]}" "${php_extensions[@]}"