From 4d2d966adadee9dd83fe62274f42b0e78b937aa0 Mon Sep 17 00:00:00 2001 From: Mistral OZ - MIO Date: Mon, 29 Aug 2022 18:19:16 +0200 Subject: [PATCH] Fixe multiarch arm64 support --- .github/workflows/workflow.yml | 11 +- Dockerfile.apache | 15 +- Dockerfile.apache.node10 | 9 +- Dockerfile.apache.node12 | 9 +- Dockerfile.apache.node14 | 9 +- Dockerfile.apache.node16 | 9 +- Dockerfile.cli | 15 +- Dockerfile.cli.node10 | 9 +- Dockerfile.cli.node12 | 9 +- Dockerfile.cli.node14 | 9 +- Dockerfile.cli.node16 | 9 +- Dockerfile.fpm | 15 +- Dockerfile.fpm.node10 | 9 +- Dockerfile.fpm.node12 | 9 +- Dockerfile.fpm.node14 | 9 +- Dockerfile.fpm.node16 | 9 +- Dockerfile.slim.apache | 20 +-- Dockerfile.slim.cli | 20 +-- Dockerfile.slim.fpm | 20 +-- docker-bake.hcl | 225 ++++++++++++++++++++++++++++++ extensions/core/docker-install.sh | 1 + utils/Dockerfile.blueprint | 17 +-- utils/Dockerfile.node.blueprint | 14 +- utils/Dockerfile.slim.blueprint | 46 +++--- utils/docker-bake.blueprint.hcl | 6 + 25 files changed, 358 insertions(+), 175 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 58c8b31e..03a3ec94 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -27,7 +27,7 @@ jobs: - name: Build locally run: | PHP_VERSION="${{ matrix.php_version }}" - docker buildx bake --pull --load \ + docker buildx bake --load \ --set "*.platform=linux/amd64" \ php${PHP_VERSION//.}-${{ matrix.variant }} docker images --filter=reference=thecodingmachine/php @@ -42,9 +42,10 @@ jobs: # Merge ~ push. if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} run: | - PHP_VERSION="${{ matrix.php_version }}" - PHP_PATCH_VERSION=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` - PHP_PATCH_MINOR="${PHP_PATCH_VERSION}" docker buildx bake --pull \ + PHP_VERSION="${{ matrix.php_version }}" \ + PHP_PATCH_VERSION=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` \ + PHP_PATCH_MINOR="${PHP_PATCH_VERSION}" \ + docker buildx bake \ --set "*.platform=linux/amd64,linux/arm64" \ - --set=*.output=type=registry \ + --set "*.output=type=registry" \ php${PHP_VERSION//.}-${{ matrix.variant }} diff --git a/Dockerfile.apache b/Dockerfile.apache index 83698d60..05196e97 100644 --- a/Dockerfile.apache +++ b/Dockerfile.apache @@ -4,18 +4,13 @@ ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache - -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ENV CONTAINER_OS=${TARGETOS} -ENV CONTAINER_ARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} - - +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache as baseapp LABEL authors="Julien Neuhart , David Négrier " +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 + # |-------------------------------------------------------------------------- # | Main PHP extensions # |-------------------------------------------------------------------------- diff --git a/Dockerfile.apache.node10 b/Dockerfile.apache.node10 index b6304551..a3752a81 100644 --- a/Dockerfile.apache.node10 +++ b/Dockerfile.apache.node10 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.apache.node12 b/Dockerfile.apache.node12 index d76f0ff5..22df0156 100644 --- a/Dockerfile.apache.node12 +++ b/Dockerfile.apache.node12 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.apache.node14 b/Dockerfile.apache.node14 index b53ef199..49a006f8 100644 --- a/Dockerfile.apache.node14 +++ b/Dockerfile.apache.node14 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.apache.node16 b/Dockerfile.apache.node16 index c6bdf42e..8bf14ef2 100644 --- a/Dockerfile.apache.node16 +++ b/Dockerfile.apache.node16 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.cli b/Dockerfile.cli index f06b9fe7..1d64507a 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -4,18 +4,13 @@ ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli - -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ENV CONTAINER_OS=${TARGETOS} -ENV CONTAINER_ARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} - - +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli as baseapp LABEL authors="Julien Neuhart , David Négrier " +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 + # |-------------------------------------------------------------------------- # | Main PHP extensions # |-------------------------------------------------------------------------- diff --git a/Dockerfile.cli.node10 b/Dockerfile.cli.node10 index a3b432ba..b4c7fd15 100644 --- a/Dockerfile.cli.node10 +++ b/Dockerfile.cli.node10 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.cli.node12 b/Dockerfile.cli.node12 index 6af91d1a..52fe4208 100644 --- a/Dockerfile.cli.node12 +++ b/Dockerfile.cli.node12 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.cli.node14 b/Dockerfile.cli.node14 index 9eb02fd4..2be12c05 100644 --- a/Dockerfile.cli.node14 +++ b/Dockerfile.cli.node14 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.cli.node16 b/Dockerfile.cli.node16 index 5d54cc8a..bcb17561 100644 --- a/Dockerfile.cli.node16 +++ b/Dockerfile.cli.node16 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.fpm b/Dockerfile.fpm index 0a45e8eb..f139b82c 100644 --- a/Dockerfile.fpm +++ b/Dockerfile.fpm @@ -4,18 +4,13 @@ ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-fpm - -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ENV CONTAINER_OS=${TARGETOS} -ENV CONTAINER_ARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} - - +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-fpm as baseapp LABEL authors="Julien Neuhart , David Négrier " +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 + # |-------------------------------------------------------------------------- # | Main PHP extensions # |-------------------------------------------------------------------------- diff --git a/Dockerfile.fpm.node10 b/Dockerfile.fpm.node10 index 83ee2f42..c3bf8634 100644 --- a/Dockerfile.fpm.node10 +++ b/Dockerfile.fpm.node10 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.fpm.node12 b/Dockerfile.fpm.node12 index 5ca1c19c..76414521 100644 --- a/Dockerfile.fpm.node12 +++ b/Dockerfile.fpm.node12 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.fpm.node14 b/Dockerfile.fpm.node14 index be926770..459a6639 100644 --- a/Dockerfile.fpm.node14 +++ b/Dockerfile.fpm.node14 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.fpm.node16 b/Dockerfile.fpm.node16 index afd3f4a4..ff34925f 100644 --- a/Dockerfile.fpm.node16 +++ b/Dockerfile.fpm.node16 @@ -1,14 +1,11 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -ARG PHP_VERSION -ARG GLOBAL_VERSION +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm as baseapp +LABEL authors="Julien Neuhart , David Négrier " + ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} diff --git a/Dockerfile.slim.apache b/Dockerfile.slim.apache index 1c53f6e4..78f32a1d 100644 --- a/Dockerfile.slim.apache +++ b/Dockerfile.slim.apache @@ -1,6 +1,5 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM --platform=$BUILDPLATFORM ubuntu:20.04 - +FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " # Fixes some weird terminal issues such as broken clear / CTRL+L @@ -10,15 +9,17 @@ LABEL authors="Julien Neuhart , David Négrier < ENV DEBIAN_FRONTEND=noninteractive ARG PHP_VERSION -ENV PHP_VERSION=$PHP_VERSION -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ARG BLACKFIRE_VERSION=1 ARG TARGETOS ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 +ONBUILD ARG TARGETOS=${TARGETOS} +ONBUILD ARG TARGETARCH=${TARGETARCH} +ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV TARGETOS=${TARGETOS} +ENV TARGETARCH=${TARGETARCH} ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV PHP_VERSION=${PHP_VERSION} # |-------------------------------------------------------------------------- # | Main PHP extensions @@ -363,8 +364,11 @@ ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ && echo $SUPERCRONIC_URL \ && SUPERCRONIC=supercronic-linux-${TARGETARCH} \ && SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 \ + && if [ "$TARGETARCH" == "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" == "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '$TARGETARCH' is not supported"; fi; \ && curl -fsSLO "$SUPERCRONIC_URL" \ -# && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ && chmod +x "$SUPERCRONIC" \ && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ diff --git a/Dockerfile.slim.cli b/Dockerfile.slim.cli index 8fc19387..a896705a 100644 --- a/Dockerfile.slim.cli +++ b/Dockerfile.slim.cli @@ -1,6 +1,5 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM --platform=$BUILDPLATFORM ubuntu:20.04 - +FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " # Fixes some weird terminal issues such as broken clear / CTRL+L @@ -10,15 +9,17 @@ LABEL authors="Julien Neuhart , David Négrier < ENV DEBIAN_FRONTEND=noninteractive ARG PHP_VERSION -ENV PHP_VERSION=$PHP_VERSION -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ARG BLACKFIRE_VERSION=1 ARG TARGETOS ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 +ONBUILD ARG TARGETOS=${TARGETOS} +ONBUILD ARG TARGETARCH=${TARGETARCH} +ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV TARGETOS=${TARGETOS} +ENV TARGETARCH=${TARGETARCH} ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV PHP_VERSION=${PHP_VERSION} # |-------------------------------------------------------------------------- # | Main PHP extensions @@ -268,8 +269,11 @@ ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ && echo $SUPERCRONIC_URL \ && SUPERCRONIC=supercronic-linux-${TARGETARCH} \ && SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 \ + && if [ "$TARGETARCH" == "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" == "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '$TARGETARCH' is not supported"; fi; \ && curl -fsSLO "$SUPERCRONIC_URL" \ -# && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ && chmod +x "$SUPERCRONIC" \ && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ diff --git a/Dockerfile.slim.fpm b/Dockerfile.slim.fpm index 5ab9ffca..2ca98a65 100644 --- a/Dockerfile.slim.fpm +++ b/Dockerfile.slim.fpm @@ -1,6 +1,5 @@ # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM --platform=$BUILDPLATFORM ubuntu:20.04 - +FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " # Fixes some weird terminal issues such as broken clear / CTRL+L @@ -10,15 +9,17 @@ LABEL authors="Julien Neuhart , David Négrier < ENV DEBIAN_FRONTEND=noninteractive ARG PHP_VERSION -ENV PHP_VERSION=$PHP_VERSION -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ARG BLACKFIRE_VERSION=1 ARG TARGETOS ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 +ONBUILD ARG TARGETOS=${TARGETOS} +ONBUILD ARG TARGETARCH=${TARGETARCH} +ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV TARGETOS=${TARGETOS} +ENV TARGETARCH=${TARGETARCH} ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV PHP_VERSION=${PHP_VERSION} # |-------------------------------------------------------------------------- # | Main PHP extensions @@ -291,8 +292,11 @@ ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ && echo $SUPERCRONIC_URL \ && SUPERCRONIC=supercronic-linux-${TARGETARCH} \ && SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 \ + && if [ "$TARGETARCH" == "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" == "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '$TARGETARCH' is not supported"; fi; \ && curl -fsSLO "$SUPERCRONIC_URL" \ -# && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ && chmod +x "$SUPERCRONIC" \ && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ diff --git a/docker-bake.hcl b/docker-bake.hcl index 2cd4b95c..0deadf60 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -110,6 +110,9 @@ target "php81-slim-apache" { # thecodingmachine/php:8.1-v4-apache target "php81-apache" { + contexts = { + baseapp = "target:php81-slim-apache" + } inherits = ["default"] tags = tag("8.1", "apache", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache" @@ -121,6 +124,9 @@ target "php81-apache" { # thecodingmachine/php:8.1-v4-apache-node16 target "php81-apache-node16" { + contexts = { + baseapp = "target:php81-apache" + } inherits = ["default"] tags = tag("8.1", "apache-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node16" @@ -132,6 +138,9 @@ target "php81-apache-node16" { # thecodingmachine/php:8.1-v4-apache-node14 target "php81-apache-node14" { + contexts = { + baseapp = "target:php81-apache" + } inherits = ["default"] tags = tag("8.1", "apache-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node14" @@ -143,6 +152,9 @@ target "php81-apache-node14" { # thecodingmachine/php:8.1-v4-apache-node12 target "php81-apache-node12" { + contexts = { + baseapp = "target:php81-apache" + } inherits = ["default"] tags = tag("8.1", "apache-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node12" @@ -154,6 +166,9 @@ target "php81-apache-node12" { # thecodingmachine/php:8.1-v4-apache-node10 target "php81-apache-node10" { + contexts = { + baseapp = "target:php81-apache" + } inherits = ["default"] tags = tag("8.1", "apache-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node10" @@ -179,6 +194,9 @@ target "php81-slim-fpm" { # thecodingmachine/php:8.1-v4-fpm target "php81-fpm" { + contexts = { + baseapp = "target:php81-slim-fpm" + } inherits = ["default"] tags = tag("8.1", "fpm", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm" @@ -190,6 +208,9 @@ target "php81-fpm" { # thecodingmachine/php:8.1-v4-fpm-node16 target "php81-fpm-node16" { + contexts = { + baseapp = "target:php81-fpm" + } inherits = ["default"] tags = tag("8.1", "fpm-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node16" @@ -201,6 +222,9 @@ target "php81-fpm-node16" { # thecodingmachine/php:8.1-v4-fpm-node14 target "php81-fpm-node14" { + contexts = { + baseapp = "target:php81-fpm" + } inherits = ["default"] tags = tag("8.1", "fpm-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node14" @@ -212,6 +236,9 @@ target "php81-fpm-node14" { # thecodingmachine/php:8.1-v4-fpm-node12 target "php81-fpm-node12" { + contexts = { + baseapp = "target:php81-fpm" + } inherits = ["default"] tags = tag("8.1", "fpm-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node12" @@ -223,6 +250,9 @@ target "php81-fpm-node12" { # thecodingmachine/php:8.1-v4-fpm-node10 target "php81-fpm-node10" { + contexts = { + baseapp = "target:php81-fpm" + } inherits = ["default"] tags = tag("8.1", "fpm-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node10" @@ -248,6 +278,9 @@ target "php81-slim-cli" { # thecodingmachine/php:8.1-v4-cli target "php81-cli" { + contexts = { + baseapp = "target:php81-slim-cli" + } inherits = ["default"] tags = tag("8.1", "cli", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli" @@ -259,6 +292,9 @@ target "php81-cli" { # thecodingmachine/php:8.1-v4-cli-node16 target "php81-cli-node16" { + contexts = { + baseapp = "target:php81-cli" + } inherits = ["default"] tags = tag("8.1", "cli-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node16" @@ -270,6 +306,9 @@ target "php81-cli-node16" { # thecodingmachine/php:8.1-v4-cli-node14 target "php81-cli-node14" { + contexts = { + baseapp = "target:php81-cli" + } inherits = ["default"] tags = tag("8.1", "cli-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node14" @@ -281,6 +320,9 @@ target "php81-cli-node14" { # thecodingmachine/php:8.1-v4-cli-node12 target "php81-cli-node12" { + contexts = { + baseapp = "target:php81-cli" + } inherits = ["default"] tags = tag("8.1", "cli-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node12" @@ -292,6 +334,9 @@ target "php81-cli-node12" { # thecodingmachine/php:8.1-v4-cli-node10 target "php81-cli-node10" { + contexts = { + baseapp = "target:php81-cli" + } inherits = ["default"] tags = tag("8.1", "cli-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node10" @@ -317,6 +362,9 @@ target "php80-slim-apache" { # thecodingmachine/php:8.0-v4-apache target "php80-apache" { + contexts = { + baseapp = "target:php80-slim-apache" + } inherits = ["default"] tags = tag("8.0", "apache", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache" @@ -328,6 +376,9 @@ target "php80-apache" { # thecodingmachine/php:8.0-v4-apache-node16 target "php80-apache-node16" { + contexts = { + baseapp = "target:php80-apache" + } inherits = ["default"] tags = tag("8.0", "apache-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node16" @@ -339,6 +390,9 @@ target "php80-apache-node16" { # thecodingmachine/php:8.0-v4-apache-node14 target "php80-apache-node14" { + contexts = { + baseapp = "target:php80-apache" + } inherits = ["default"] tags = tag("8.0", "apache-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node14" @@ -350,6 +404,9 @@ target "php80-apache-node14" { # thecodingmachine/php:8.0-v4-apache-node12 target "php80-apache-node12" { + contexts = { + baseapp = "target:php80-apache" + } inherits = ["default"] tags = tag("8.0", "apache-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node12" @@ -361,6 +418,9 @@ target "php80-apache-node12" { # thecodingmachine/php:8.0-v4-apache-node10 target "php80-apache-node10" { + contexts = { + baseapp = "target:php80-apache" + } inherits = ["default"] tags = tag("8.0", "apache-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node10" @@ -386,6 +446,9 @@ target "php80-slim-fpm" { # thecodingmachine/php:8.0-v4-fpm target "php80-fpm" { + contexts = { + baseapp = "target:php80-slim-fpm" + } inherits = ["default"] tags = tag("8.0", "fpm", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm" @@ -397,6 +460,9 @@ target "php80-fpm" { # thecodingmachine/php:8.0-v4-fpm-node16 target "php80-fpm-node16" { + contexts = { + baseapp = "target:php80-fpm" + } inherits = ["default"] tags = tag("8.0", "fpm-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node16" @@ -408,6 +474,9 @@ target "php80-fpm-node16" { # thecodingmachine/php:8.0-v4-fpm-node14 target "php80-fpm-node14" { + contexts = { + baseapp = "target:php80-fpm" + } inherits = ["default"] tags = tag("8.0", "fpm-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node14" @@ -419,6 +488,9 @@ target "php80-fpm-node14" { # thecodingmachine/php:8.0-v4-fpm-node12 target "php80-fpm-node12" { + contexts = { + baseapp = "target:php80-fpm" + } inherits = ["default"] tags = tag("8.0", "fpm-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node12" @@ -430,6 +502,9 @@ target "php80-fpm-node12" { # thecodingmachine/php:8.0-v4-fpm-node10 target "php80-fpm-node10" { + contexts = { + baseapp = "target:php80-fpm" + } inherits = ["default"] tags = tag("8.0", "fpm-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node10" @@ -455,6 +530,9 @@ target "php80-slim-cli" { # thecodingmachine/php:8.0-v4-cli target "php80-cli" { + contexts = { + baseapp = "target:php80-slim-cli" + } inherits = ["default"] tags = tag("8.0", "cli", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli" @@ -466,6 +544,9 @@ target "php80-cli" { # thecodingmachine/php:8.0-v4-cli-node16 target "php80-cli-node16" { + contexts = { + baseapp = "target:php80-cli" + } inherits = ["default"] tags = tag("8.0", "cli-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node16" @@ -477,6 +558,9 @@ target "php80-cli-node16" { # thecodingmachine/php:8.0-v4-cli-node14 target "php80-cli-node14" { + contexts = { + baseapp = "target:php80-cli" + } inherits = ["default"] tags = tag("8.0", "cli-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node14" @@ -488,6 +572,9 @@ target "php80-cli-node14" { # thecodingmachine/php:8.0-v4-cli-node12 target "php80-cli-node12" { + contexts = { + baseapp = "target:php80-cli" + } inherits = ["default"] tags = tag("8.0", "cli-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node12" @@ -499,6 +586,9 @@ target "php80-cli-node12" { # thecodingmachine/php:8.0-v4-cli-node10 target "php80-cli-node10" { + contexts = { + baseapp = "target:php80-cli" + } inherits = ["default"] tags = tag("8.0", "cli-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node10" @@ -524,6 +614,9 @@ target "php74-slim-apache" { # thecodingmachine/php:7.4-v4-apache target "php74-apache" { + contexts = { + baseapp = "target:php74-slim-apache" + } inherits = ["default"] tags = tag("7.4", "apache", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache" @@ -535,6 +628,9 @@ target "php74-apache" { # thecodingmachine/php:7.4-v4-apache-node16 target "php74-apache-node16" { + contexts = { + baseapp = "target:php74-apache" + } inherits = ["default"] tags = tag("7.4", "apache-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node16" @@ -546,6 +642,9 @@ target "php74-apache-node16" { # thecodingmachine/php:7.4-v4-apache-node14 target "php74-apache-node14" { + contexts = { + baseapp = "target:php74-apache" + } inherits = ["default"] tags = tag("7.4", "apache-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node14" @@ -557,6 +656,9 @@ target "php74-apache-node14" { # thecodingmachine/php:7.4-v4-apache-node12 target "php74-apache-node12" { + contexts = { + baseapp = "target:php74-apache" + } inherits = ["default"] tags = tag("7.4", "apache-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node12" @@ -568,6 +670,9 @@ target "php74-apache-node12" { # thecodingmachine/php:7.4-v4-apache-node10 target "php74-apache-node10" { + contexts = { + baseapp = "target:php74-apache" + } inherits = ["default"] tags = tag("7.4", "apache-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node10" @@ -593,6 +698,9 @@ target "php74-slim-fpm" { # thecodingmachine/php:7.4-v4-fpm target "php74-fpm" { + contexts = { + baseapp = "target:php74-slim-fpm" + } inherits = ["default"] tags = tag("7.4", "fpm", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm" @@ -604,6 +712,9 @@ target "php74-fpm" { # thecodingmachine/php:7.4-v4-fpm-node16 target "php74-fpm-node16" { + contexts = { + baseapp = "target:php74-fpm" + } inherits = ["default"] tags = tag("7.4", "fpm-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node16" @@ -615,6 +726,9 @@ target "php74-fpm-node16" { # thecodingmachine/php:7.4-v4-fpm-node14 target "php74-fpm-node14" { + contexts = { + baseapp = "target:php74-fpm" + } inherits = ["default"] tags = tag("7.4", "fpm-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node14" @@ -626,6 +740,9 @@ target "php74-fpm-node14" { # thecodingmachine/php:7.4-v4-fpm-node12 target "php74-fpm-node12" { + contexts = { + baseapp = "target:php74-fpm" + } inherits = ["default"] tags = tag("7.4", "fpm-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node12" @@ -637,6 +754,9 @@ target "php74-fpm-node12" { # thecodingmachine/php:7.4-v4-fpm-node10 target "php74-fpm-node10" { + contexts = { + baseapp = "target:php74-fpm" + } inherits = ["default"] tags = tag("7.4", "fpm-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node10" @@ -662,6 +782,9 @@ target "php74-slim-cli" { # thecodingmachine/php:7.4-v4-cli target "php74-cli" { + contexts = { + baseapp = "target:php74-slim-cli" + } inherits = ["default"] tags = tag("7.4", "cli", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli" @@ -673,6 +796,9 @@ target "php74-cli" { # thecodingmachine/php:7.4-v4-cli-node16 target "php74-cli-node16" { + contexts = { + baseapp = "target:php74-cli" + } inherits = ["default"] tags = tag("7.4", "cli-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node16" @@ -684,6 +810,9 @@ target "php74-cli-node16" { # thecodingmachine/php:7.4-v4-cli-node14 target "php74-cli-node14" { + contexts = { + baseapp = "target:php74-cli" + } inherits = ["default"] tags = tag("7.4", "cli-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node14" @@ -695,6 +824,9 @@ target "php74-cli-node14" { # thecodingmachine/php:7.4-v4-cli-node12 target "php74-cli-node12" { + contexts = { + baseapp = "target:php74-cli" + } inherits = ["default"] tags = tag("7.4", "cli-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node12" @@ -706,6 +838,9 @@ target "php74-cli-node12" { # thecodingmachine/php:7.4-v4-cli-node10 target "php74-cli-node10" { + contexts = { + baseapp = "target:php74-cli" + } inherits = ["default"] tags = tag("7.4", "cli-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node10" @@ -731,6 +866,9 @@ target "php73-slim-apache" { # thecodingmachine/php:7.3-v4-apache target "php73-apache" { + contexts = { + baseapp = "target:php73-slim-apache" + } inherits = ["default"] tags = tag("7.3", "apache", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache" @@ -742,6 +880,9 @@ target "php73-apache" { # thecodingmachine/php:7.3-v4-apache-node16 target "php73-apache-node16" { + contexts = { + baseapp = "target:php73-apache" + } inherits = ["default"] tags = tag("7.3", "apache-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node16" @@ -753,6 +894,9 @@ target "php73-apache-node16" { # thecodingmachine/php:7.3-v4-apache-node14 target "php73-apache-node14" { + contexts = { + baseapp = "target:php73-apache" + } inherits = ["default"] tags = tag("7.3", "apache-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node14" @@ -764,6 +908,9 @@ target "php73-apache-node14" { # thecodingmachine/php:7.3-v4-apache-node12 target "php73-apache-node12" { + contexts = { + baseapp = "target:php73-apache" + } inherits = ["default"] tags = tag("7.3", "apache-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node12" @@ -775,6 +922,9 @@ target "php73-apache-node12" { # thecodingmachine/php:7.3-v4-apache-node10 target "php73-apache-node10" { + contexts = { + baseapp = "target:php73-apache" + } inherits = ["default"] tags = tag("7.3", "apache-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node10" @@ -800,6 +950,9 @@ target "php73-slim-fpm" { # thecodingmachine/php:7.3-v4-fpm target "php73-fpm" { + contexts = { + baseapp = "target:php73-slim-fpm" + } inherits = ["default"] tags = tag("7.3", "fpm", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm" @@ -811,6 +964,9 @@ target "php73-fpm" { # thecodingmachine/php:7.3-v4-fpm-node16 target "php73-fpm-node16" { + contexts = { + baseapp = "target:php73-fpm" + } inherits = ["default"] tags = tag("7.3", "fpm-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node16" @@ -822,6 +978,9 @@ target "php73-fpm-node16" { # thecodingmachine/php:7.3-v4-fpm-node14 target "php73-fpm-node14" { + contexts = { + baseapp = "target:php73-fpm" + } inherits = ["default"] tags = tag("7.3", "fpm-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node14" @@ -833,6 +992,9 @@ target "php73-fpm-node14" { # thecodingmachine/php:7.3-v4-fpm-node12 target "php73-fpm-node12" { + contexts = { + baseapp = "target:php73-fpm" + } inherits = ["default"] tags = tag("7.3", "fpm-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node12" @@ -844,6 +1006,9 @@ target "php73-fpm-node12" { # thecodingmachine/php:7.3-v4-fpm-node10 target "php73-fpm-node10" { + contexts = { + baseapp = "target:php73-fpm" + } inherits = ["default"] tags = tag("7.3", "fpm-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node10" @@ -869,6 +1034,9 @@ target "php73-slim-cli" { # thecodingmachine/php:7.3-v4-cli target "php73-cli" { + contexts = { + baseapp = "target:php73-slim-cli" + } inherits = ["default"] tags = tag("7.3", "cli", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli" @@ -880,6 +1048,9 @@ target "php73-cli" { # thecodingmachine/php:7.3-v4-cli-node16 target "php73-cli-node16" { + contexts = { + baseapp = "target:php73-cli" + } inherits = ["default"] tags = tag("7.3", "cli-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node16" @@ -891,6 +1062,9 @@ target "php73-cli-node16" { # thecodingmachine/php:7.3-v4-cli-node14 target "php73-cli-node14" { + contexts = { + baseapp = "target:php73-cli" + } inherits = ["default"] tags = tag("7.3", "cli-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node14" @@ -902,6 +1076,9 @@ target "php73-cli-node14" { # thecodingmachine/php:7.3-v4-cli-node12 target "php73-cli-node12" { + contexts = { + baseapp = "target:php73-cli" + } inherits = ["default"] tags = tag("7.3", "cli-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node12" @@ -913,6 +1090,9 @@ target "php73-cli-node12" { # thecodingmachine/php:7.3-v4-cli-node10 target "php73-cli-node10" { + contexts = { + baseapp = "target:php73-cli" + } inherits = ["default"] tags = tag("7.3", "cli-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node10" @@ -938,6 +1118,9 @@ target "php72-slim-apache" { # thecodingmachine/php:7.2-v4-apache target "php72-apache" { + contexts = { + baseapp = "target:php72-slim-apache" + } inherits = ["default"] tags = tag("7.2", "apache", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache" @@ -949,6 +1132,9 @@ target "php72-apache" { # thecodingmachine/php:7.2-v4-apache-node16 target "php72-apache-node16" { + contexts = { + baseapp = "target:php72-apache" + } inherits = ["default"] tags = tag("7.2", "apache-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node16" @@ -960,6 +1146,9 @@ target "php72-apache-node16" { # thecodingmachine/php:7.2-v4-apache-node14 target "php72-apache-node14" { + contexts = { + baseapp = "target:php72-apache" + } inherits = ["default"] tags = tag("7.2", "apache-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node14" @@ -971,6 +1160,9 @@ target "php72-apache-node14" { # thecodingmachine/php:7.2-v4-apache-node12 target "php72-apache-node12" { + contexts = { + baseapp = "target:php72-apache" + } inherits = ["default"] tags = tag("7.2", "apache-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node12" @@ -982,6 +1174,9 @@ target "php72-apache-node12" { # thecodingmachine/php:7.2-v4-apache-node10 target "php72-apache-node10" { + contexts = { + baseapp = "target:php72-apache" + } inherits = ["default"] tags = tag("7.2", "apache-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.apache.node10" @@ -1007,6 +1202,9 @@ target "php72-slim-fpm" { # thecodingmachine/php:7.2-v4-fpm target "php72-fpm" { + contexts = { + baseapp = "target:php72-slim-fpm" + } inherits = ["default"] tags = tag("7.2", "fpm", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm" @@ -1018,6 +1216,9 @@ target "php72-fpm" { # thecodingmachine/php:7.2-v4-fpm-node16 target "php72-fpm-node16" { + contexts = { + baseapp = "target:php72-fpm" + } inherits = ["default"] tags = tag("7.2", "fpm-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node16" @@ -1029,6 +1230,9 @@ target "php72-fpm-node16" { # thecodingmachine/php:7.2-v4-fpm-node14 target "php72-fpm-node14" { + contexts = { + baseapp = "target:php72-fpm" + } inherits = ["default"] tags = tag("7.2", "fpm-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node14" @@ -1040,6 +1244,9 @@ target "php72-fpm-node14" { # thecodingmachine/php:7.2-v4-fpm-node12 target "php72-fpm-node12" { + contexts = { + baseapp = "target:php72-fpm" + } inherits = ["default"] tags = tag("7.2", "fpm-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node12" @@ -1051,6 +1258,9 @@ target "php72-fpm-node12" { # thecodingmachine/php:7.2-v4-fpm-node10 target "php72-fpm-node10" { + contexts = { + baseapp = "target:php72-fpm" + } inherits = ["default"] tags = tag("7.2", "fpm-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.fpm.node10" @@ -1076,6 +1286,9 @@ target "php72-slim-cli" { # thecodingmachine/php:7.2-v4-cli target "php72-cli" { + contexts = { + baseapp = "target:php72-slim-cli" + } inherits = ["default"] tags = tag("7.2", "cli", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli" @@ -1087,6 +1300,9 @@ target "php72-cli" { # thecodingmachine/php:7.2-v4-cli-node16 target "php72-cli-node16" { + contexts = { + baseapp = "target:php72-cli" + } inherits = ["default"] tags = tag("7.2", "cli-node16", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node16" @@ -1098,6 +1314,9 @@ target "php72-cli-node16" { # thecodingmachine/php:7.2-v4-cli-node14 target "php72-cli-node14" { + contexts = { + baseapp = "target:php72-cli" + } inherits = ["default"] tags = tag("7.2", "cli-node14", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node14" @@ -1109,6 +1328,9 @@ target "php72-cli-node14" { # thecodingmachine/php:7.2-v4-cli-node12 target "php72-cli-node12" { + contexts = { + baseapp = "target:php72-cli" + } inherits = ["default"] tags = tag("7.2", "cli-node12", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node12" @@ -1120,6 +1342,9 @@ target "php72-cli-node12" { # thecodingmachine/php:7.2-v4-cli-node10 target "php72-cli-node10" { + contexts = { + baseapp = "target:php72-cli" + } inherits = ["default"] tags = tag("7.2", "cli-node10", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.cli.node10" diff --git a/extensions/core/docker-install.sh b/extensions/core/docker-install.sh index 170bfd4d..5970ae9a 100755 --- a/extensions/core/docker-install.sh +++ b/extensions/core/docker-install.sh @@ -38,6 +38,7 @@ if [ -n "$PECL_EXTENSION" ]; then fi if [ -n "$USE_PECL" ]; then + pecl channel-update pecl.php.net && pecl channel-update pear.php.net pecl install $PECL_EXTENSION else pickle install $PECL_EXTENSION diff --git a/utils/Dockerfile.blueprint b/utils/Dockerfile.blueprint index 418b462a..8034526f 100644 --- a/utils/Dockerfile.blueprint +++ b/utils/Dockerfile.blueprint @@ -1,22 +1,15 @@ -{{- $variant := .Orbit.variant -}} - ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-{{ $variant }} - -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ENV CONTAINER_OS=${TARGETOS} -ENV CONTAINER_ARCH=${TARGETARCH} -ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} - - +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-{{ .Orbit.variant }} as baseapp LABEL authors="Julien Neuhart , David Négrier " +ARG TARGETOS +ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 + # |-------------------------------------------------------------------------- # | Main PHP extensions # |-------------------------------------------------------------------------- diff --git a/utils/Dockerfile.node.blueprint b/utils/Dockerfile.node.blueprint index 1519dfbb..2f959b1d 100644 --- a/utils/Dockerfile.node.blueprint +++ b/utils/Dockerfile.node.blueprint @@ -1,30 +1,24 @@ -{{- $variant := .Orbit.variant -}} -{{- $node_version := .Orbit.node_version -}} +FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-{{ .Orbit.variant }} as baseapp +LABEL authors="Julien Neuhart , David Négrier " -ARG PHP_VERSION -ARG GLOBAL_VERSION ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 -FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-{{ $variant }} - -LABEL authors="Julien Neuhart , David Négrier " - USER root ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} RUN apt-get update && \ apt-get install -y --no-install-recommends gnupg && \ - curl -sL https://deb.nodesource.com/setup_{{ $node_version }}.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_{{ .Orbit.node_version }}.x | bash - && \ apt-get update && \ apt-get install -y --no-install-recommends nodejs && \ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt-get update && \ apt-get install -y --no-install-recommends yarn && \ - npm install -g npm{{ if eq "10" $node_version }}@^6.14{{end}} && \ + npm install -g npm{{ if eq "10" .Orbit.node_version }}@^6.14{{end}} && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* diff --git a/utils/Dockerfile.slim.blueprint b/utils/Dockerfile.slim.blueprint index f295bd12..21f6874d 100644 --- a/utils/Dockerfile.slim.blueprint +++ b/utils/Dockerfile.slim.blueprint @@ -1,7 +1,4 @@ -{{- $variant := .Orbit.variant -}} - -FROM --platform=$BUILDPLATFORM ubuntu:20.04 - +FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " # Fixes some weird terminal issues such as broken clear / CTRL+L @@ -11,15 +8,17 @@ LABEL authors="Julien Neuhart , David Négrier < ENV DEBIAN_FRONTEND=noninteractive ARG PHP_VERSION -ENV PHP_VERSION=$PHP_VERSION -ONBUILD ARG TARGETOS -ONBUILD ARG TARGETARCH -ONBUILD ARG BLACKFIRE_VERSION=1 -ARG BLACKFIRE_VERSION=1 ARG TARGETOS ARG TARGETARCH +ARG BLACKFIRE_VERSION=1 +ONBUILD ARG TARGETOS=${TARGETOS} +ONBUILD ARG TARGETARCH=${TARGETARCH} +ONBUILD ARG BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV TARGETOS=${TARGETOS} +ENV TARGETARCH=${TARGETARCH} ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} +ENV PHP_VERSION=${PHP_VERSION} # |-------------------------------------------------------------------------- # | Main PHP extensions @@ -150,7 +149,7 @@ RUN composer global require bamarni/symfony-console-autocomplete && \ USER root -{{if eq $variant "apache" }} +{{if eq .Orbit.variant "apache" }} ENV APACHE_CONFDIR /etc/apache2 ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars @@ -226,7 +225,7 @@ RUN rm /etc/php/${PHP_VERSION}/apache2/php.ini RUN a2enmod rewrite {{end}} -{{if eq $variant "fpm" }} +{{if eq .Orbit.variant "fpm" }} RUN apt-get update \ && apt-get install -y --no-install-recommends php${PHP_VERSION}-fpm \ && apt-get clean \ @@ -240,14 +239,14 @@ COPY utils/fpm-zz-docker.conf /etc/php/${PHP_VERSION}/fpm/pool.d/zz-docker.conf {{end}} -{{if eq $variant "cli" }} +{{if eq .Orbit.variant "cli" }} RUN mkdir -p /usr/src/app && chown docker:docker /usr/src/app WORKDIR /usr/src/app {{end}} -{{if eq $variant "fpm" }} +{{if eq .Orbit.variant "fpm" }} RUN mkdir -p /var/www/html && chown -R docker: /var/www {{end}} -{{if or (eq $variant "apache") (eq $variant "fpm") }} +{{if or (eq .Orbit.variant "apache") (eq .Orbit.variant "fpm") }} RUN chown docker:docker /var/www/html WORKDIR /var/www/html {{end}} @@ -307,7 +306,7 @@ RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/ # | Defines the entrypoint. # | -ENV IMAGE_VARIANT={{$variant}} +ENV IMAGE_VARIANT={{ .Orbit.variant }} # Add Tini (to be able to stop the container with ctrl-c). # See: https://github.com/krallin/tini @@ -317,7 +316,7 @@ RUN chmod +x /tini COPY utils/generate_cron.php /usr/local/bin/generate_cron.php COPY utils/startup_commands.php /usr/local/bin/startup_commands.php -{{if eq $variant "apache" }} +{{if eq .Orbit.variant "apache" }} COPY utils/enable_apache_mods.php /usr/local/bin/enable_apache_mods.php COPY utils/apache-expose-envvars.sh /usr/local/bin/apache-expose-envvars.sh {{end}} @@ -329,7 +328,7 @@ RUN ln -s ${PHP_VERSION} /usr/local/lib/thecodingmachine-php/extensions/current ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] -{{if eq $variant "apache" }} +{{if eq .Orbit.variant "apache" }} # Let's register a servername to remove the message "apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message" RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf RUN a2enconf servername @@ -348,19 +347,19 @@ CMD ["apache2-foreground"] ENV APACHE_RUN_USER=docker \ APACHE_RUN_GROUP=docker {{end}} -{{if eq $variant "cli" }} +{{if eq .Orbit.variant "cli" }} CMD ["php", "-v"] {{end}} -{{if eq $variant "fpm" }} +{{if eq .Orbit.variant "fpm" }} CMD ["php-fpm"] {{end}} RUN touch /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini && ln -s /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini /etc/php/${PHP_VERSION}/cli/conf.d/generated_conf.ini -{{if eq $variant "apache" }} +{{if eq .Orbit.variant "apache" }} RUN ln -s /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini /etc/php/${PHP_VERSION}/apache2/conf.d/generated_conf.ini {{end}} -{{if eq $variant "fpm" }} +{{if eq .Orbit.variant "fpm" }} RUN ln -s /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini /etc/php/${PHP_VERSION}/fpm/conf.d/generated_conf.ini && \ sed -i 's/^user = www-data/;user = www-data/g' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \ sed -i 's/^group = www-data/;group = www-data/g' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \ @@ -394,8 +393,11 @@ ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ && echo $SUPERCRONIC_URL \ && SUPERCRONIC=supercronic-linux-${TARGETARCH} \ && SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85 \ + && if [ "$TARGETARCH" == "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" == "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '$TARGETARCH' is not supported"; fi; \ && curl -fsSLO "$SUPERCRONIC_URL" \ -# && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ + && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ && chmod +x "$SUPERCRONIC" \ && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ diff --git a/utils/docker-bake.blueprint.hcl b/utils/docker-bake.blueprint.hcl index 050ed677..ed7ef268 100644 --- a/utils/docker-bake.blueprint.hcl +++ b/utils/docker-bake.blueprint.hcl @@ -57,6 +57,9 @@ target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" { # thecodingmachine/php:{{ $phpV }}-v4-{{ $variant }} target "php{{ $phpV | replace "." "" }}-{{ $variant }}" { + contexts = { + baseapp = "target:php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" + } inherits = ["default"] tags = tag("{{ $phpV }}", "{{ $variant }}", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.{{ $variant }}" @@ -68,6 +71,9 @@ target "php{{ $phpV | replace "." "" }}-{{ $variant }}" { {{range $nodeV := $nodeVersions}} # thecodingmachine/php:{{ $phpV }}-v4-{{ $variant }}-node{{ $nodeV }} target "php{{ $phpV | replace "." "" }}-{{ $variant }}-node{{ $nodeV }}" { + contexts = { + baseapp = "target:php{{ $phpV | replace "." "" }}-{{ $variant }}" + } inherits = ["default"] tags = tag("{{ $phpV }}", "{{ $variant }}-node{{ $nodeV }}", "${PHP_PATCH_MINOR}") dockerfile = "Dockerfile.{{ $variant }}.node{{ $nodeV }}"