* PHP 8.4

* feat: pr-lint, updates, php84 build

* chore(lint): fix lint errors, add .editorconfig

* chore(ci): testing kics config

* feat: refactor structure, add configs, lint.sh
This commit is contained in:
2025-05-13 21:26:52 +03:00
committed by GitHub
parent 1e56bfdcb9
commit eec02d4fa6
22 changed files with 460 additions and 97 deletions

5
.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
.github
.editorconfig
.mega-linter.yml
lint.sh
README.md

10
.editorconfig Normal file
View File

@@ -0,0 +1,10 @@
# EditorConfig is awesome: https://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

View File

@@ -1,6 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>ivuorinen/renovate-config"
]
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>ivuorinen/renovate-config"]
}

View File

@@ -15,6 +15,8 @@ env:
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
permissions: read-all
jobs:
BuildAndRelease:
runs-on: ubuntu-latest
@@ -26,26 +28,26 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [php74, php80, php81, php82, php83]
arch: ['linux/amd64', 'linux/arm64']
php: [php74, php80, php81, php82, php83, php84]
arch: ["linux/amd64", "linux/arm64"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push (${{ matrix.php }} / ${{ matrix.arch }})
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
with:
file: Dockerfile-${{ matrix.php }}
file: ${{ matrix.php }}/Dockerfile
platforms: ${{ matrix.arch }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.php }}

32
.github/workflows/pr-lint.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint Code Base
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
Linter:
name: PR Lint
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
statuses: write
contents: read
packages: read
issues: write
pull-requests: write
steps:
- name: Run PR Lint
# https://github.com/ivuorinen/actions
uses: ivuorinen/actions/pr-lint@140177528bc0a5a27fcf20a2bf19f6c9390d001c # 25.5.12

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
megalinter-reports

8
.hadolint.yaml Normal file
View File

@@ -0,0 +1,8 @@
---
##########################
## Hadolint config file ##
##########################
ignored:
- DL3018
- DL3008
- SC2046

5
.kics.config.yaml Normal file
View File

@@ -0,0 +1,5 @@
type:
- Dockerfile
exclude-queries:
- fd54f200-402c-4333-a5a4-36ef6709af2f
- 965a08d7-ef86-4f14-8792-4a3b2098937e

23
.mega-linter.yml Normal file
View File

@@ -0,0 +1,23 @@
---
# Configuration file for MegaLinter
# See all available variables at
# https://megalinter.io/ and in linters documentation
APPLY_FIXES: all
PARALLEL: false
SHOW_ELAPSED_TIME: false # Show elapsed time at the end of MegaLinter run
FILEIO_REPORTER: false # Generate file.io report
GITHUB_STATUS_REPORTER: true # Generate GitHub status report
IGNORE_GENERATED_FILES: true # Ignore generated files
PRINT_ALPACA: false # Print Alpaca logo in console
SARIF_REPORTER: true # Generate SARIF report
SHOW_SKIPPED_LINTERS: false # Show skipped linters in MegaLinter log
FLAVOR_SUGGESTIONS: false
REPOSITORY_KICS_CONFIG_FILE: ".kics.config.yaml"
DISABLE_LINTERS:
- REPOSITORY_DEVSKIM
- REPOSITORY_GRYPE
- SPELL_CSPELL
- PHP_PSALM
- COPYPASTE_JSCPD

View File

@@ -1,17 +0,0 @@
FROM php:7.4
RUN docker-php-ext-install bcmath \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& apt-get update \
&& apt-get install -y \
libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \
libpng-dev libonig-dev libmagickwand-dev python3-dev unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN php --version \
&& composer --version \

View File

@@ -1,17 +0,0 @@
FROM php:8.0
RUN docker-php-ext-install bcmath \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& apt-get update \
&& apt-get install -y \
libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \
libpng-dev libonig-dev libmagickwand-dev python3-dev unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN php --version \
&& composer --version \

View File

@@ -1,17 +0,0 @@
FROM php:8.1
RUN docker-php-ext-install bcmath \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& apt-get update \
&& apt-get install -y \
libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \
libpng-dev libonig-dev libmagickwand-dev python3-dev unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN php --version \
&& composer --version \

View File

@@ -1,17 +0,0 @@
FROM php:8.2
RUN docker-php-ext-install bcmath \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& apt-get update \
&& apt-get install -y \
libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \
libpng-dev libonig-dev libmagickwand-dev python3-dev unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN php --version \
&& composer --version \

View File

@@ -1,17 +0,0 @@
FROM php:8.3
RUN docker-php-ext-install bcmath \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& apt-get update \
&& apt-get install -y \
libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \
libpng-dev libonig-dev libmagickwand-dev python3-dev unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN php --version \
&& composer --version \

View File

@@ -1,2 +1,3 @@
# docker-php-with-imagick-multi
PHP 7.4-8.2 with imagick for arm64 and amd64
PHP 7.4-8.4 with imagick for arm64 and amd64

45
lint.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Check that Docker is running
if ! command -v docker &>/dev/null; then
echo "(!) Docker is not installed. Please install Docker to proceed."
exit 1
fi
if ! docker ps &>/dev/null; then
echo "(!) Docker is not running. Please start Docker to proceed."
exit 1
fi
if ! command -v npx &>/dev/null; then
echo "(!) node / npx is not installed."
exit 1
fi
if command -v shfmt &>/dev/null; then
echo "Running shfmt..."
shfmt .
fi
if command -v pinact &>/dev/null; then
echo "Running pinact..."
pinact run -u
fi
# If "megalinter-reports" folder exists, delete it
if [ -d "megalinter-reports" ]; then
if rm -rf "./megalinter-reports"; then
echo "Deleted megalinter-reports..."
else
echo "Failed to delete megalinter-reports." >&2
exit 1
fi
fi
# Run mega-linter, it requires Docker
npx \
--yes mega-linter-runner \
--flavor cupcake \
--fix \
--remove-container \
--container-name cupcake

53
php74/Dockerfile Normal file
View File

@@ -0,0 +1,53 @@
# vim: set ft=dockerfile ts=2 sw=2 sts=2 et:
FROM php:7.4@sha256:620a6b9f4d4feef2210026172570465e9d0c1de79766418d3affd09190a7fda5
LABEL \
maintainer="Ismo Vuorinen <ismo@ivuorinen.net>" \
version="1.0" \
description="PHP 7.4 with Imagick and Composer"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install PHP extensions and required libraries
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
libicu-dev=* \
libxml2-dev=2.* \
libfreetype6-dev=2.* \
libjpeg62-turbo-dev=* \
libpng-dev=1.* \
libonig-dev=6.* \
libmagickwand-dev=8:6.* \
python3-dev=3.* \
unzip=6.* \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mbstring \
pdo \
xml \
gd \
exif \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
RUN set -o pipefail \
&& curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# Verify installations
RUN set -o pipefail \
&& php --version \
&& composer --version
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD php -v || exit 1
USER www-data

53
php80/Dockerfile Normal file
View File

@@ -0,0 +1,53 @@
# vim: set ft=dockerfile ts=2 sw=2 sts=2 et:
FROM php:8.0@sha256:0569e384b9064c04dec55dc6e41be41b494a878dfbb6577a7d76bd50cfd5bc00
LABEL \
maintainer="Ismo Vuorinen <ismo@ivuorinen.net>" \
version="1.0" \
description="PHP 8.0 with Imagick and Composer"
USER www-data
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD php -v || exit 1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install PHP extensions and required libraries
RUN set -o pipefail \
&& apt-get update --no-cache \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libxml2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libonig-dev \
libmagickwand-dev \
python3-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mbstring \
pdo \
xml \
gd \
exif \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
RUN set -o pipefail \
&& curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# Verify installations
RUN set -o pipefail \
&& php --version \
&& composer --version

53
php81/Dockerfile Normal file
View File

@@ -0,0 +1,53 @@
# vim: set ft=dockerfile ts=2 sw=2 sts=2 et:
FROM php:8.1@sha256:a57aba6a50bbb85fcd6fffaf45048c9f54a9cdec0e64d0cb5985d4d1a44e2634
LABEL \
maintainer="Ismo Vuorinen <ismo@ivuorinen.net>" \
version="1.0" \
description="PHP 8.1 with Imagick and Composer"
USER www-data
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD php -v || exit 1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install PHP extensions and required libraries
RUN set -o pipefail \
&& apt-get update --no-cache \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libxml2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libonig-dev \
libmagickwand-dev \
python3-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mbstring \
pdo \
xml \
gd \
exif \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
RUN set -o pipefail \
&& curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# Verify installations
RUN set -o pipefail \
&& php --version \
&& composer --version

53
php82/Dockerfile Normal file
View File

@@ -0,0 +1,53 @@
# vim: set ft=dockerfile ts=2 sw=2 sts=2 et:
FROM php:8.2@sha256:ed4385b854a7ef4aeee1108c75333443d64c937faaf7c7d28bf63a436df06428
LABEL \
maintainer="Ismo Vuorinen <ismo@ivuorinen.net>" \
version="1.0" \
description="PHP 8.2 with Imagick and Composer"
USER www-data
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD php -v || exit 1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install PHP extensions and required libraries
RUN set -o pipefail \
&& apt-get update --no-cache \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libxml2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libonig-dev \
libmagickwand-dev \
python3-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mbstring \
pdo \
xml \
gd \
exif \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
RUN set -o pipefail \
&& curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# Verify installations
RUN set -o pipefail \
&& php --version \
&& composer --version

53
php83/Dockerfile Normal file
View File

@@ -0,0 +1,53 @@
# vim: set ft=dockerfile ts=2 sw=2 sts=2 et:
FROM php:8.3@sha256:2643907fd60518306cfe9b68ac1e969065e55362b685b16b1c2b333af1e494ef
LABEL \
maintainer="Ismo Vuorinen <ismo@ivuorinen.net>" \
version="1.0" \
description="PHP 8.3 with Imagick and Composer"
USER www-data
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD php -v || exit 1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install PHP extensions and required libraries
RUN set -o pipefail \
&& apt-get update --no-cache \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libxml2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libonig-dev \
libmagickwand-dev \
python3-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mbstring \
pdo \
xml \
gd \
exif \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
RUN set -o pipefail \
&& curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# Verify installations
RUN set -o pipefail \
&& php --version \
&& composer --version

53
php84/Dockerfile Normal file
View File

@@ -0,0 +1,53 @@
# vim: set ft=dockerfile ts=2 sw=2 sts=2 et:
FROM php:8.4@sha256:9eddbbdc9dc382a1e40d1d41ef5306ca00dbf088e3ba066f08717827d699592e
LABEL \
maintainer="Ismo Vuorinen <ismo@ivuorinen.net>" \
version="1.0" \
description="PHP 8.4 with Imagick and Composer"
USER www-data
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD php -v || exit 1
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install PHP extensions and required libraries
RUN set -o pipefail \
&& apt-get update --no-cache \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libxml2-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libonig-dev \
libmagickwand-dev \
python3-dev \
unzip \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
bcmath \
intl \
mbstring \
pdo \
xml \
gd \
exif \
&& docker-php-ext-configure pcntl \
&& docker-php-ext-install pcntl \
&& yes '' | pecl install imagick \
&& docker-php-ext-enable imagick \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Composer
RUN set -o pipefail \
&& curl -sS https://getcomposer.org/installer | \
php -- --install-dir=/usr/local/bin --filename=composer
# Verify installations
RUN set -o pipefail \
&& php --version \
&& composer --version