Skip to content

Commit

Permalink
Fixe multiarch arm64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mistraloz committed Aug 30, 2022
1 parent a258b8e commit 4d2d966
Show file tree
Hide file tree
Showing 25 changed files with 358 additions and 175 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
15 changes: 5 additions & 10 deletions Dockerfile.apache
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

# |--------------------------------------------------------------------------
# | Main PHP extensions
# |--------------------------------------------------------------------------
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.apache.node10
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.apache.node12
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.apache.node14
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.apache.node16
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
15 changes: 5 additions & 10 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

# |--------------------------------------------------------------------------
# | Main PHP extensions
# |--------------------------------------------------------------------------
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.cli.node10
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.cli.node12
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.cli.node14
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.cli.node16
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-cli

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
15 changes: 5 additions & 10 deletions Dockerfile.fpm
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

# |--------------------------------------------------------------------------
# | Main PHP extensions
# |--------------------------------------------------------------------------
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.fpm.node10
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.fpm.node12
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.fpm.node14
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
9 changes: 3 additions & 6 deletions Dockerfile.fpm.node16
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

ARG TARGETOS
ARG TARGETARCH
ARG BLACKFIRE_VERSION=1

FROM --platform=$BUILDPLATFORM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-fpm

LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

USER root

ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
Expand Down
20 changes: 12 additions & 8 deletions Dockerfile.slim.apache
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

# Fixes some weird terminal issues such as broken clear / CTRL+L
Expand All @@ -10,15 +9,17 @@ LABEL authors="Julien Neuhart <[email protected]>, 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
Expand Down Expand Up @@ -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; \
Expand Down
20 changes: 12 additions & 8 deletions Dockerfile.slim.cli
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, David Négrier <[email protected]>"

# Fixes some weird terminal issues such as broken clear / CTRL+L
Expand All @@ -10,15 +9,17 @@ LABEL authors="Julien Neuhart <[email protected]>, 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
Expand Down Expand Up @@ -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; \
Expand Down
Loading

0 comments on commit 4d2d966

Please sign in to comment.