diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c431bf8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.github +.editorconfig +.mega-linter.yml +lint.sh +README.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..6ec9ed0 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.github/renovate.json b/.github/renovate.json index e46316f..66f4a27 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -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"] } diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c7a90ec..52c022e 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,6 +15,8 @@ env: # github.repository as / 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 }} diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 0000000..b6f3d6c --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b3a9c9d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +megalinter-reports diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..3691953 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,8 @@ +--- +########################## +## Hadolint config file ## +########################## +ignored: + - DL3018 + - DL3008 + - SC2046 diff --git a/.kics.config.yaml b/.kics.config.yaml new file mode 100644 index 0000000..1e4f4b4 --- /dev/null +++ b/.kics.config.yaml @@ -0,0 +1,5 @@ +type: + - Dockerfile +exclude-queries: + - fd54f200-402c-4333-a5a4-36ef6709af2f + - 965a08d7-ef86-4f14-8792-4a3b2098937e diff --git a/.mega-linter.yml b/.mega-linter.yml new file mode 100644 index 0000000..49f189c --- /dev/null +++ b/.mega-linter.yml @@ -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 diff --git a/Dockerfile-php74 b/Dockerfile-php74 deleted file mode 100644 index cba7ecb..0000000 --- a/Dockerfile-php74 +++ /dev/null @@ -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 \ diff --git a/Dockerfile-php80 b/Dockerfile-php80 deleted file mode 100644 index ef0c2b5..0000000 --- a/Dockerfile-php80 +++ /dev/null @@ -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 \ diff --git a/Dockerfile-php81 b/Dockerfile-php81 deleted file mode 100644 index 4f58929..0000000 --- a/Dockerfile-php81 +++ /dev/null @@ -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 \ diff --git a/Dockerfile-php82 b/Dockerfile-php82 deleted file mode 100644 index 283cb87..0000000 --- a/Dockerfile-php82 +++ /dev/null @@ -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 \ diff --git a/Dockerfile-php83 b/Dockerfile-php83 deleted file mode 100644 index 9bcf1d0..0000000 --- a/Dockerfile-php83 +++ /dev/null @@ -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 \ diff --git a/README.md b/README.md index 4245f07..43bd9be 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lint.sh b/lint.sh new file mode 100755 index 0000000..eec9a71 --- /dev/null +++ b/lint.sh @@ -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 diff --git a/php74/Dockerfile b/php74/Dockerfile new file mode 100644 index 0000000..1e73862 --- /dev/null +++ b/php74/Dockerfile @@ -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 " \ + 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 diff --git a/php80/Dockerfile b/php80/Dockerfile new file mode 100644 index 0000000..b9b97e4 --- /dev/null +++ b/php80/Dockerfile @@ -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 " \ + 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 diff --git a/php81/Dockerfile b/php81/Dockerfile new file mode 100644 index 0000000..f8a8ac7 --- /dev/null +++ b/php81/Dockerfile @@ -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 " \ + 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 diff --git a/php82/Dockerfile b/php82/Dockerfile new file mode 100644 index 0000000..e58dfc2 --- /dev/null +++ b/php82/Dockerfile @@ -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 " \ + 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 diff --git a/php83/Dockerfile b/php83/Dockerfile new file mode 100644 index 0000000..cd11e9d --- /dev/null +++ b/php83/Dockerfile @@ -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 " \ + 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 diff --git a/php84/Dockerfile b/php84/Dockerfile new file mode 100644 index 0000000..f12b663 --- /dev/null +++ b/php84/Dockerfile @@ -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 " \ + 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