Skip to content

Commit 2a39e59

Browse files
authored
Merge pull request #325 from thecodingmachine/hotfix/multiarch
Fix multiarch + Add bash_unit for testing
2 parents 4f33616 + 68e5d3f commit 2a39e59

File tree

125 files changed

+1939
-1171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+1939
-1171
lines changed

.dockerignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/.git*
2+
/docker-bake.hcl
3+
/Dockerfile.*
4+
/Makefile
5+
/*.md
6+
/LICENSE
7+
/orbit*
8+
/test*
9+
/utils/*.blueprint.*
10+
/utils/*.blueprint

.github/workflows/workflow.yml

+85-32
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,112 @@ on:
77
push:
88
branches:
99
- 'v4'
10-
# schedule:
11-
# - cron: '42 3 * * 0'
10+
schedule:
11+
- cron: '42 3 * * 0'
1212

1313
jobs:
14-
build_test_maybe_release:
14+
test:
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
php_version: ['8.1','8.0','7.4', '7.3','7.2']
1819
variant: ['apache','cli','fpm']
19-
runs-on: ubuntu-latest
20+
# builder: [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "macos-latest"}]
21+
builder: [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}]
22+
runs-on: ${{ matrix.builder.os }}
23+
name: Test ${{ matrix.php_version }}-${{ matrix.variant }} ${{ matrix.builder.arch }} only
2024
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
- name: Set up Docker
28+
# /!\ this action is marked as experimental
29+
# It's required only for macos
30+
if: ${{ matrix.builder.os == 'macos-latest' }}
31+
uses: docker-practice/actions-setup-docker@master
2132
- name: Set up QEMU
22-
uses: docker/setup-qemu-action@v1
33+
uses: docker/setup-qemu-action@v2
2334
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v1
35+
uses: docker/setup-buildx-action@v2
36+
- name: Build
37+
run: |
38+
PHP_VERSION="${{ matrix.php_version }}"
39+
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
40+
docker buildx bake \
41+
--set "*.platform=linux/${{ matrix.builder.arch }}" \
42+
--set "*.output=type=docker" \
43+
--load \
44+
php${PHP_VERSION//.}-${{ matrix.variant }}-all
45+
- name: Display tags built
46+
run: |
47+
docker image ls --filter="reference=thecodingmachine/php" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}"
48+
- name: Test
49+
run: |
50+
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
51+
PHP_VERSION="${{ matrix.php_version }}" \
52+
BRANCH="v4" \
53+
VARIANT="${{ matrix.variant }}" \
54+
PLATFORM="linux/${{ matrix.builder.arch }}" \
55+
./tests-suite/bash_unit -f tap ./tests-suite/*.sh
56+
57+
publish:
58+
# push ~ schedule
59+
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
60+
needs:
61+
- test
62+
runs-on: ubuntu-latest
63+
name: Publish ${{ matrix.php_version }}-${{ matrix.variant }} multi-arch to dockerhub
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
php_version: ['8.1','8.0','7.4', '7.3','7.2']
68+
variant: ['apache','cli','fpm']
69+
steps:
2570
- name: Checkout
26-
uses: actions/checkout@v1
27-
# - name: Build locally
28-
# run: |
29-
# PHP_VERSION="${{ matrix.php_version }}"
30-
# docker buildx bake --load \
31-
# --set "*.platform=linux/amd64" \
32-
# php${PHP_VERSION//.}-slim-${{ matrix.variant }}
33-
# docker buildx bake --load \
34-
# --set "*.platform=linux/amd64" \
35-
# php${PHP_VERSION//.}-${{ matrix.variant }}-all
36-
# PHP_VERSION_MINOR=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-cli php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1`
37-
# echo "PHP_VERSION_MINOR=${PHP_VERSION_MINOR}" >> $GITHUB_ENV
38-
# echo "PHP Version : ${PHP_VERSION_MINOR}" >> $GITHUB_STEP_SUMMARY
39-
# docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY
40-
# - name: Test ${{ matrix.variant }}
41-
# run: |
42-
# PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} ./test-image.sh
43-
# echo "${{ matrix.variant }} variant OK" >> $GITHUB_STEP_SUMMARY
71+
uses: actions/checkout@v3
72+
- name: Set up QEMU
73+
uses: docker/setup-qemu-action@v2
74+
- name: Set up Docker Buildx
75+
uses: docker/setup-buildx-action@v2
4476
- name: Login to DockerHub
45-
# Merge ~ push.
46-
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
4777
uses: docker/login-action@v1
4878
with:
4979
username: ${{ secrets.DOCKERHUB_USERNAME }}
5080
password: ${{ secrets.DOCKERHUB_TOKEN }}
51-
- name: Build and push to repository
52-
# Merge ~ push.
53-
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
81+
- name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with tagged prefix
5482
run: |
5583
PHP_VERSION="${{ matrix.php_version }}"
84+
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
5685
docker buildx bake \
5786
--set "*.platform=linux/amd64,linux/arm64" \
5887
--set "*.output=type=registry" \
59-
php${PHP_VERSION//.}-slim-${{ matrix.variant }}
60-
PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:${PHP_VERSION}-v4-slim-cli php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1` \
88+
php${PHP_VERSION//.}-${{ matrix.variant }}-all
89+
- name: Fetch minor version of php
90+
run: |
91+
# Retrieve minor version
92+
PHP_PATCH_MINOR=`docker run --rm thecodingmachine/php:rc-${GITHUB_SHA::7}-${{ matrix.php_version }}-v4-slim-${{ matrix.variant }} php -v | head -n1 | grep -P '\d+\.\d+\.\d+' -o | head -n1`
93+
echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV
94+
- name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with releases tags (major and minor)
95+
run: |
96+
PHP_VERSION="${{ matrix.php_version }}"
97+
PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \
6198
docker buildx bake \
6299
--set "*.platform=linux/amd64,linux/arm64" \
63100
--set "*.output=type=registry" \
101+
--metadata-file "/tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log"
64102
php${PHP_VERSION//.}-${{ matrix.variant }}-all
65-
docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY
103+
- name: Artifacts
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: digests-${{ matrix.php_version }}-${{ matrix.variant }}
107+
path: /tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log
108+
retention-days: 60
109+
- name: Display tags built
110+
run: |
111+
echo "With prefix :"
112+
TAG_PREFIX="rc${GITHUB_SHA::7}-" \
113+
docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r
114+
echo "-----"
115+
echo "Regular :"
116+
PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \
117+
docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r
118+

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
.idea
2-
tmp
1+
.idea

Dockerfile.apache

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
#syntax=docker/dockerfile-upstream:1
12
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint)
23
ARG INSTALL_CRON=1
34
ARG INSTALL_COMPOSER=1
45
ARG PHP_VERSION
56
ARG GLOBAL_VERSION
7+
ARG REPO="thecodingmachine/php"
8+
ARG TAG_PREFIX=""
69

7-
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache as baseapp
10+
ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache"
11+
FROM $FROM_IMAGE
812
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"
13+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
914

1015
ARG TARGETOS
1116
ARG TARGETARCH

Dockerfile.apache.node14 renamed to Dockerfile.apache.node

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1+
#syntax=docker/dockerfile-upstream:1
12
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint)
2-
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp
3+
ARG REPO="thecodingmachine/php"
4+
ARG TAG_PREFIX=""
5+
ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}:${PHP_VERSION}-${GLOBAL_VERSION}-apache"
6+
FROM $FROM_IMAGE
37
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"
8+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
49

510
ARG TARGETOS
611
ARG TARGETARCH
712
ARG BLACKFIRE_VERSION=1
13+
ARG NODE_VERSION=16
814

915
USER root
1016

1117
ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
1218

1319
RUN apt-get update && \
1420
apt-get install -y --no-install-recommends gnupg && \
15-
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
21+
curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
1622
apt-get update && \
1723
apt-get install -y --no-install-recommends nodejs && \
1824
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
1925
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
2026
apt-get update && \
2127
apt-get install -y --no-install-recommends yarn && \
22-
npm install -g npm && \
28+
if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \
2329
apt-get clean && \
2430
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
2531

Dockerfile.apache.node16

-26
This file was deleted.

Dockerfile.cli

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
#syntax=docker/dockerfile-upstream:1
12
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint)
23
ARG INSTALL_CRON=1
34
ARG INSTALL_COMPOSER=1
45
ARG PHP_VERSION
56
ARG GLOBAL_VERSION
7+
ARG REPO="thecodingmachine/php"
8+
ARG TAG_PREFIX=""
69

7-
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli as baseapp
10+
ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli"
11+
FROM $FROM_IMAGE
812
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"
13+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
914

1015
ARG TARGETOS
1116
ARG TARGETARCH

Dockerfile.apache.node10 renamed to Dockerfile.cli.node

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1+
#syntax=docker/dockerfile-upstream:1
12
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint)
2-
FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp
3+
ARG REPO="thecodingmachine/php"
4+
ARG TAG_PREFIX=""
5+
ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}:${PHP_VERSION}-${GLOBAL_VERSION}-cli"
6+
FROM $FROM_IMAGE
37
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"
8+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
49

510
ARG TARGETOS
611
ARG TARGETARCH
712
ARG BLACKFIRE_VERSION=1
13+
ARG NODE_VERSION=16
814

915
USER root
1016

1117
ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION}
1218

1319
RUN apt-get update && \
1420
apt-get install -y --no-install-recommends gnupg && \
15-
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
21+
curl -sL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - && \
1622
apt-get update && \
1723
apt-get install -y --no-install-recommends nodejs && \
1824
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
1925
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
2026
apt-get update && \
2127
apt-get install -y --no-install-recommends yarn && \
22-
npm install -g npm@^6.14 && \
28+
if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \
2329
apt-get clean && \
2430
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
2531

Dockerfile.cli.node10

-26
This file was deleted.

Dockerfile.cli.node12

-26
This file was deleted.

Dockerfile.cli.node14

-26
This file was deleted.

0 commit comments

Comments
 (0)