diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95247a4..23f346b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,13 +16,8 @@ permissions: jobs: release: - name: Publish ${{ matrix.cpu }} layers + name: Publish layers runs-on: ubuntu-latest - strategy: - matrix: - cpu: - - x86 - - arm steps: - uses: actions/checkout@v3 @@ -47,25 +42,13 @@ jobs: - run: make docker-images env: - CPU: ${{ matrix.cpu }} USE_DEPOT: 1 DEPOT_TOKEN: ${{ secrets.DEPOT_TOKEN }} - run: make layers - env: - CPU: ${{ matrix.cpu }} - - run: make test - env: - CPU: ${{ matrix.cpu }} - - run: make upload-layers - env: - CPU: ${{ matrix.cpu }} - - run: make upload-to-docker-hub - env: - CPU: ${{ matrix.cpu }} update-layer-versions: name: Update layer versions in brefphp/bref diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 43f22fb..ee4f673 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,38 +13,14 @@ permissions: contents: read jobs: - matrix-prep: - name: Prepare matrix - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.result }} - steps: - - uses: actions/github-script@v6 - id: set-matrix - with: - script: | - const matrix = { - cpu: ['x86', 'arm'], - php_version: ['80', '81', '82'], - } - - // If this is a third-party pull request, skip ARM builds - if (context.eventName === 'pull_request') { - const pr = context.payload.pull_request - if (pr.head.repo.full_name !== pr.base.repo.full_name) { - matrix.cpu = ['x86'] - } - } - - return matrix tests: - name: Build and tests PHP ${{ matrix.php_version }}, ${{ matrix.cpu }} + name: Build and tests PHP ${{ matrix.php_version }} runs-on: ubuntu-latest - needs: matrix-prep strategy: fail-fast: false - matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }} + matrix: + php_version: ['80', '81', '82'] steps: - uses: actions/checkout@v3 @@ -64,26 +40,16 @@ jobs: # If this is a third-party pull request, fall back to the local buildx builder buildx-fallback: ${{ github.event.pull_request.head.repo.full_name != github.repository }} env: - CPU: ${{ matrix.cpu }} - CPU_PREFIX: ${{ (matrix.cpu == 'arm') && 'arm-' || '' }} PHP_VERSION: ${{ matrix.php_version }} - IMAGE_VERSION_SUFFIX: ${{ (matrix.cpu == 'arm') && 'arm64' || 'x86_64' }} - DOCKER_PLATFORM: ${{ (matrix.cpu == 'arm') && 'linux/arm64' || 'linux/amd64' }} - name: Test that layers can be exported run: | make layer-php-${{ matrix.php_version }} make layer-php-${{ matrix.php_version }}-fpm - env: - CPU: ${{ matrix.cpu }} - name: Test that the "console" layer can be exported run: make layer-console if: ${{ matrix.php_version == 80 }} - env: - CPU: ${{ matrix.cpu }} - name: Run tests run: make test-${{ matrix.php_version }} - env: - CPU: ${{ matrix.cpu }} diff --git a/Makefile b/Makefile index 03aa3de..45099b9 100644 --- a/Makefile +++ b/Makefile @@ -5,18 +5,24 @@ export # export all variables defined in .env # Define all the environment variables depending on the CPU # Set CPU= (empty) to build for x86 # Set CPU=arm to build for ARM -ifeq ($(CPU), arm) # if $CPU=="arm" +ifeq ($(CPU), x86) # if $CPU=="x86" + $(info "⚠️ Building for x86") # Print a message + export CPU = x86 + export CPU_PREFIX = + export DOCKER_PLATFORM = linux/amd64 + export BAKE_OPTIONS = --set *.platform=${DOCKER_PLATFORM} +else ifeq ($(CPU), arm) # if $CPU=="arm" $(info "⚠️ Building for ARM") # Print a message export CPU = arm export CPU_PREFIX = arm- - export IMAGE_VERSION_SUFFIX = arm64 export DOCKER_PLATFORM = linux/arm64 + export BAKE_OPTIONS = --set *.platform=${DOCKER_PLATFORM} else - $(info "⚠️ Building for x86") # Print a message - export CPU = x86 + $(info "⚠️ Building for x86 and ARM") # Print a message + export CPU = export CPU_PREFIX = - export IMAGE_VERSION_SUFFIX = x86_64 - export DOCKER_PLATFORM = linux/amd64 + export DOCKER_PLATFORM = + export BAKE_OPTIONS = endif # By default, Docker images are built using `docker buildx bake` @@ -37,21 +43,18 @@ default: docker-images layers # Build Docker images *locally* docker-images: docker-images-php-80 docker-images-php-81 docker-images-php-82 docker-images-php-%: - PHP_VERSION=$* ${BAKE_COMMAND} --load + PHP_VERSION=$* ${BAKE_COMMAND} --load ${BAKE_OPTIONS} # Build Lambda layers (zip files) *locally* -layers: layer-php-80 layer-php-81 layer-php-82 layer-php-80-fpm layer-php-81-fpm layer-php-82-fpm - # Build the console layer only once (x86 and single PHP version) - @if [ ${CPU} = "x86" ]; then \ - $(MAKE) layer-console; \ - fi +layers: layer-php-80 layer-php-81 layer-php-82 layer-php-80-fpm layer-php-81-fpm layer-php-82-fpm layer-console layer-console: - ./utils/docker-zip-dir.sh bref/console-zip console + DOCKER_PLATFORM=linux/amd64 ./utils/docker-zip-dir.sh bref/console-zip console # This rule matches with a wildcard, for example `layer-php-80`. # The `$*` variable will contained the matched part, in this case `php-80`. layer-%: - ./utils/docker-zip-dir.sh bref/${CPU_PREFIX}$* ${CPU_PREFIX}$* + DOCKER_PLATFORM=linux/amd64 ./utils/docker-zip-dir.sh bref/$* $* + DOCKER_PLATFORM=linux/arm64 ./utils/docker-zip-dir.sh bref/$* arm-$* # Upload the layers to AWS Lambda @@ -73,8 +76,8 @@ upload-layers-php-%: upload-to-docker-hub: upload-to-docker-hub-php-80 upload-to-docker-hub-php-81 upload-to-docker-hub-php-82 upload-to-docker-hub-php-%: for image in \ - "bref/${CPU_PREFIX}php-$*" "bref/${CPU_PREFIX}php-$*-fpm" "bref/${CPU_PREFIX}php-$*-console" \ - "bref/${CPU_PREFIX}build-php-$*" "bref/${CPU_PREFIX}php-$*-fpm-dev"; \ + "bref/php-$*" "bref/php-$*-fpm" "bref/php-$*-console" \ + "bref/build-php-$*" "bref/php-$*-fpm-dev"; \ do \ docker tag $$image $$image:2 ; \ docker push $$image --all-tags ; \ @@ -83,20 +86,19 @@ upload-to-docker-hub-php-%: test: test-80 test-81 test-82 test-%: - cd tests && $(MAKE) test-$* + cd tests && DOCKER_PLATFORM=linux/amd64 $(MAKE) test-$* + cd tests && DOCKER_PLATFORM=linux/arm64 $(MAKE) test-$* clean: clean-80 clean-81 clean-82 # Clear the build cache, else all images will be rebuilt using cached layers docker builder prune # Remove zip files - rm -f output/${CPU_PREFIX}*.zip + rm -f output/*.zip clean-%: # Clean Docker images to force rebuilding them - docker image rm --force bref/${CPU_PREFIX}build-php-$* \ - bref/${CPU_PREFIX}php-$* \ - bref/${CPU_PREFIX}php-$*-zip \ - bref/${CPU_PREFIX}php-$*-fpm \ - bref/${CPU_PREFIX}php-$*-fpm-zip \ - bref/${CPU_PREFIX}php-$*-fpm-dev \ - bref/${CPU_PREFIX}php-$*-console + docker image rm --force bref/build-php-$* \ + bref/php-$* \ + bref/php-$*-fpm \ + bref/php-$*-fpm-dev \ + bref/php-$*-console diff --git a/docker-bake.hcl b/docker-bake.hcl index 19aee00..620eee7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -2,62 +2,45 @@ group "default" { targets = ["build-php", "php", "php-fpm", "console-zip", "console", "php-fpm-dev"] } -variable "CPU" { - default = "x86" -} -variable "CPU_PREFIX" { - default = "" -} variable "PHP_VERSION" { default = "80" } -variable "IMAGE_VERSION_SUFFIX" { - default = "x86_64" -} -variable "DOCKER_PLATFORM" { - default = "linux/amd64" -} variable "PHP_COMPILATION_FLAGS" { - default = "" + default = "" } target "build-php" { dockerfile = "php-${PHP_VERSION}/Dockerfile" target = "build-environment" - tags = ["bref/${CPU_PREFIX}build-php-${PHP_VERSION}"] + tags = ["bref/build-php-${PHP_VERSION}"] args = { - "IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}" "PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}" } - platforms = ["${DOCKER_PLATFORM}"] + platforms = ["linux/arm64", "linux/amd64"] } target "php" { dockerfile = "php-${PHP_VERSION}/Dockerfile" target = "function" - tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}"] + tags = ["bref/php-${PHP_VERSION}"] args = { - "IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}" "PHP_COMPILATION_FLAGS" = "${PHP_COMPILATION_FLAGS}" } - contexts = { - "bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php" + contexts = { + "bref/build-php-${PHP_VERSION}" = "target:build-php" } - platforms = ["${DOCKER_PLATFORM}"] + platforms = ["linux/arm64", "linux/amd64"] } target "php-fpm" { dockerfile = "php-${PHP_VERSION}/Dockerfile" target = "fpm" - tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm"] - args = { - "IMAGE_VERSION_SUFFIX" = "${IMAGE_VERSION_SUFFIX}" - } - contexts = { - "bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php" - "bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php" + tags = ["bref/php-${PHP_VERSION}-fpm"] + contexts = { + "bref/build-php-${PHP_VERSION}" = "target:build-php" + "bref/php-${PHP_VERSION}" = "target:php" } - platforms = ["${DOCKER_PLATFORM}"] + platforms = ["linux/arm64", "linux/amd64"] } target "console-zip" { @@ -66,38 +49,35 @@ target "console-zip" { tags = ["bref/console-zip"] args = { PHP_VERSION = "${PHP_VERSION}" - CPU_PREFIX = "${CPU_PREFIX}" } - platforms = ["${DOCKER_PLATFORM}"] + platforms = ["linux/arm64", "linux/amd64"] } target "console" { context = "layers/console" target = "console" - tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-console"] + tags = ["bref/php-${PHP_VERSION}-console"] args = { PHP_VERSION = "${PHP_VERSION}" - CPU_PREFIX = "${CPU_PREFIX}" } contexts = { - "bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php" - "bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php" + "bref/build-php-${PHP_VERSION}" = "target:build-php" + "bref/php-${PHP_VERSION}" = "target:php" } - platforms = ["${DOCKER_PLATFORM}"] + platforms = ["linux/arm64", "linux/amd64"] } target "php-fpm-dev" { context = "layers/fpm-dev" - tags = ["bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm-dev"] + tags = ["bref/php-${PHP_VERSION}-fpm-dev"] args = { PHP_VERSION = "${PHP_VERSION}" - CPU_PREFIX = "${CPU_PREFIX}" } contexts = { - "bref/${CPU_PREFIX}build-php-${PHP_VERSION}" = "target:build-php" - "bref/${CPU_PREFIX}php-${PHP_VERSION}" = "target:php" - "bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm" = "target:php-fpm" - "bref/local-api-gateway" = "docker-image://bref/local-api-gateway:latest" + "bref/build-php-${PHP_VERSION}" = "target:build-php" + "bref/php-${PHP_VERSION}" = "target:php" + "bref/php-${PHP_VERSION}-fpm" = "target:php-fpm" + "bref/local-api-gateway" = "docker-image://bref/local-api-gateway:latest" } - platforms = ["${DOCKER_PLATFORM}"] + platforms = ["linux/arm64", "linux/amd64"] } diff --git a/layers/fpm-dev/Dockerfile b/layers/fpm-dev/Dockerfile index a7ea68f..2268054 100644 --- a/layers/fpm-dev/Dockerfile +++ b/layers/fpm-dev/Dockerfile @@ -1,9 +1,8 @@ # syntax = docker/dockerfile:1.4 -ARG CPU_PREFIX ARG PHP_VERSION -FROM bref/${CPU_PREFIX}build-php-$PHP_VERSION as build_extensions +FROM bref/build-php-$PHP_VERSION as build_extensions ARG PHP_VERSION @@ -16,11 +15,11 @@ RUN cp $(php -r "echo ini_get('extension_dir');")/xdebug.so /opt/bref/extensions # Install Blackfire # https://blackfire.io/docs/up-and-running/installation?action=install&mode=full&version=latest&mode=full&location=server&os=manual&language=php#install-the-php-probe ARG BLACKFIRE_VERSION=1.86.1 -RUN if [[ $CPU_PREFIX == "" ]]; then curl -A "Docker" -o /opt/bref/extensions/blackfire.so -L -s "https://packages.blackfire.io/binaries/blackfire-php/$BLACKFIRE_VERSION/blackfire-php-linux_amd64-php-"$PHP_VERSION".so"; fi -RUN if [[ $CPU_PREFIX == "arm-" ]]; then curl -A "Docker" -o /opt/bref/extensions/blackfire.so -L -s "https://packages.blackfire.io/binaries/blackfire-php/$BLACKFIRE_VERSION/blackfire-php-linux_arm64-php-"$PHP_VERSION".so"; fi +RUN if [[ $CPU == "x86" ]]; then curl -A "Docker" -o /opt/bref/extensions/blackfire.so -L -s "https://packages.blackfire.io/binaries/blackfire-php/$BLACKFIRE_VERSION/blackfire-php-linux_amd64-php-"$PHP_VERSION".so"; fi +RUN if [[ $CPU == "arm" ]]; then curl -A "Docker" -o /opt/bref/extensions/blackfire.so -L -s "https://packages.blackfire.io/binaries/blackfire-php/$BLACKFIRE_VERSION/blackfire-php-linux_arm64-php-"$PHP_VERSION".so"; fi -FROM bref/${CPU_PREFIX}php-${PHP_VERSION}-fpm +FROM bref/php-${PHP_VERSION}-fpm COPY --link --from=build_extensions /opt /opt COPY --link bref-entrypoint.sh / diff --git a/php-80/Dockerfile b/php-80/Dockerfile index 94982dd..1567153 100644 --- a/php-80/Dockerfile +++ b/php-80/Dockerfile @@ -1,8 +1,5 @@ # syntax = docker/dockerfile:1.4 -# Can be "x86_64" or "arm64" -ARG IMAGE_VERSION_SUFFIX - # https://www.php.net/downloads ARG VERSION_PHP=8.0.28 @@ -11,7 +8,7 @@ ARG VERSION_PHP=8.0.28 # https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html # AWS provides a Docker image that we use here: # https://github.com/amazonlinux/container-images/tree/amzn2 -FROM public.ecr.aws/lambda/provided:al2-${IMAGE_VERSION_SUFFIX} as build-environment +FROM public.ecr.aws/lambda/provided:al2 as build-environment RUN set -xe \ @@ -450,7 +447,7 @@ RUN cp ${CA_BUNDLE} /bref-layer/bref/ssl/cert.pem # --------------------------------------------------------------- # Start from a clean image to copy only the files we need -FROM public.ecr.aws/lambda/provided:al2-${IMAGE_VERSION_SUFFIX} as isolation +FROM public.ecr.aws/lambda/provided:al2 as isolation # We selected the files in /bref-layer, now we copy them to /opt (the real directory for the Lambda layer) COPY --link --from=build-environment /bref-layer /opt diff --git a/php-81/Dockerfile b/php-81/Dockerfile index fb8a5a5..1f52799 100644 --- a/php-81/Dockerfile +++ b/php-81/Dockerfile @@ -1,8 +1,5 @@ # syntax = docker/dockerfile:1.4 -# Can be "x86_64" or "arm64" -ARG IMAGE_VERSION_SUFFIX - # https://www.php.net/downloads ARG VERSION_PHP=8.1.19 @@ -11,7 +8,7 @@ ARG VERSION_PHP=8.1.19 # https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html # AWS provides a Docker image that we use here: # https://github.com/amazonlinux/container-images/tree/amzn2 -FROM public.ecr.aws/lambda/provided:al2-${IMAGE_VERSION_SUFFIX} as build-environment +FROM public.ecr.aws/lambda/provided:al2 as build-environment RUN set -xe \ @@ -452,7 +449,7 @@ RUN cp ${CA_BUNDLE} /bref-layer/bref/ssl/cert.pem # --------------------------------------------------------------- # Start from a clean image to copy only the files we need -FROM public.ecr.aws/lambda/provided:al2-${IMAGE_VERSION_SUFFIX} as isolation +FROM public.ecr.aws/lambda/provided:al2 as isolation # We selected the files in /bref-layer, now we copy them to /opt (the real directory for the Lambda layer) COPY --link --from=build-environment /bref-layer /opt diff --git a/php-82/Dockerfile b/php-82/Dockerfile index c60f5bd..67d5b09 100644 --- a/php-82/Dockerfile +++ b/php-82/Dockerfile @@ -1,8 +1,5 @@ # syntax = docker/dockerfile:1.4 -# Can be "x86_64" or "arm64" -ARG IMAGE_VERSION_SUFFIX - # https://www.php.net/downloads ARG VERSION_PHP=8.2.6 @@ -11,7 +8,7 @@ ARG VERSION_PHP=8.2.6 # https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html # AWS provides a Docker image that we use here: # https://github.com/amazonlinux/container-images/tree/amzn2 -FROM public.ecr.aws/lambda/provided:al2-${IMAGE_VERSION_SUFFIX} as build-environment +FROM public.ecr.aws/lambda/provided:al2 as build-environment RUN set -xe \ @@ -452,7 +449,7 @@ RUN cp ${CA_BUNDLE} /bref-layer/bref/ssl/cert.pem # --------------------------------------------------------------- # Start from a clean image to copy only the files we need -FROM public.ecr.aws/lambda/provided:al2-${IMAGE_VERSION_SUFFIX} as isolation +FROM public.ecr.aws/lambda/provided:al2 as isolation # We selected the files in /bref-layer, now we copy them to /opt (the real directory for the Lambda layer) COPY --link --from=build-environment /bref-layer /opt diff --git a/tests/Makefile b/tests/Makefile index 1716939..12fdead 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,54 +1,52 @@ -export CPU_PREFIX ?= - test: test-80 test-81 test-82 # This rule matches with a wildcard, for example `test-80`. # The `$*` variable will contained the matched part, in this case `80`. test-%: vendor - docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/${CPU_PREFIX}php-$* test_1_binary.php $* - docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/${CPU_PREFIX}php-$*-fpm test_1_binary.php $* - docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/${CPU_PREFIX}php-$*-fpm-dev test_1_binary.php $* + docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/php-$* test_1_binary.php $* + docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/php-$*-fpm test_1_binary.php $* + docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/php-$*-fpm-dev test_1_binary.php $* - docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/${CPU_PREFIX}php-$* test_2_extensions.php - docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/${CPU_PREFIX}php-$*-fpm test_2_extensions.php - docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/${CPU_PREFIX}php-$*-fpm-dev test_2_extensions.php + docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/php-$* test_2_extensions.php + docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/php-$*-fpm test_2_extensions.php + docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php bref/php-$*-fpm-dev test_2_extensions.php docker run --platform=${DOCKER_PLATFORM} --rm -v=$(PWD):/var/task:ro --entrypoint=php \ - -e PHP_INI_SCAN_DIR="/opt/bref/etc/php/conf.d/:/var/task/" bref/${CPU_PREFIX}php-$* \ + -e PHP_INI_SCAN_DIR="/opt/bref/etc/php/conf.d/:/var/task/" bref/php-$* \ test_3_manual_enabling_extensions.php # Test function handler - docker stop test-${CPU_PREFIX}php-$* 2> /dev/null || true # silence errors - docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-${CPU_PREFIX}php-$* \ - bref/${CPU_PREFIX}php-$* test_4_function_handler.php - docker exec test-${CPU_PREFIX}php-$* php test_4_function_invocation.php \ - || (docker logs test-${CPU_PREFIX}php-$* && exit 1) - docker stop test-${CPU_PREFIX}php-$* + docker stop test-php-$* 2> /dev/null || true # silence errors + docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$* \ + bref/php-$* test_4_function_handler.php + docker exec test-php-$* php test_4_function_invocation.php \ + || (docker logs test-php-$* && exit 1) + docker stop test-php-$* # Test FPM handler - docker stop test-${CPU_PREFIX}php-$*-fpm 2> /dev/null || true # silence errors - docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-${CPU_PREFIX}php-$*-fpm \ - bref/${CPU_PREFIX}php-$*-fpm test_5_fpm_handler.php - docker exec test-${CPU_PREFIX}php-$*-fpm php test_5_fpm_invocation.php \ - || (docker logs test-${CPU_PREFIX}php-$*-fpm && exit 1) # print logs in case of failure - docker stop test-${CPU_PREFIX}php-$*-fpm + docker stop test-php-$*-fpm 2> /dev/null || true # silence errors + docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$*-fpm \ + bref/php-$*-fpm test_5_fpm_handler.php + docker exec test-php-$*-fpm php test_5_fpm_invocation.php \ + || (docker logs test-php-$*-fpm && exit 1) # print logs in case of failure + docker stop test-php-$*-fpm # Test console handler - docker stop test-${CPU_PREFIX}php-$*-console 2> /dev/null || true # silence errors - docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-${CPU_PREFIX}php-$*-console \ - bref/${CPU_PREFIX}php-$*-console test_6_console_handler.php - docker exec test-${CPU_PREFIX}php-$*-console php test_6_console_invocation.php \ - || (docker logs test-${CPU_PREFIX}php-$*-console && exit 1) # print logs in case of failure - docker stop test-${CPU_PREFIX}php-$*-console + docker stop test-php-$*-console 2> /dev/null || true # silence errors + docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$*-console \ + bref/php-$*-console test_6_console_handler.php + docker exec test-php-$*-console php test_6_console_invocation.php \ + || (docker logs test-php-$*-console && exit 1) # print logs in case of failure + docker stop test-php-$*-console # Test that we can override PHP_INI_SCAN_DIR - docker stop test-${CPU_PREFIX}php-$*-test7 2> /dev/null || true # silence errors - docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-${CPU_PREFIX}php-$*-test7 \ + docker stop test-php-$*-test7 2> /dev/null || true # silence errors + docker run --platform=${DOCKER_PLATFORM} --rm --detach -v=$(PWD):/var/task:ro --name test-php-$*-test7 \ -e PHP_INI_SCAN_DIR="/opt/bref/etc/php/conf.d/:/var/task/" \ - bref/${CPU_PREFIX}php-$* test_4_function_handler.php - docker exec test-${CPU_PREFIX}php-$*-test7 php test_7_custom_ini_scan_dir.php \ - || (docker logs test-${CPU_PREFIX}php-$*-test7 && exit 1) # print logs in case of failure - docker stop test-${CPU_PREFIX}php-$*-test7 + bref/php-$* test_4_function_handler.php + docker exec test-php-$*-test7 php test_7_custom_ini_scan_dir.php \ + || (docker logs test-php-$*-test7 && exit 1) # print logs in case of failure + docker stop test-php-$*-test7 echo "\033[1;32m✓ Tests succeeded\033[0m"