diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..e7224775 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +/.git* +/docker-bake.hcl +/Dockerfile.* +/Makefile +/*.md +/LICENSE +/orbit* +/test* +/utils/*.blueprint.* +/utils/*.blueprint diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 120fcdab..2182582c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -7,59 +7,112 @@ on: push: branches: - 'v4' -# schedule: -# - cron: '42 3 * * 0' + schedule: + - cron: '42 3 * * 0' jobs: - build_test_maybe_release: + test: strategy: + fail-fast: false matrix: php_version: ['8.1','8.0','7.4', '7.3','7.2'] variant: ['apache','cli','fpm'] - runs-on: ubuntu-latest +# builder: [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "macos-latest"}] + builder: [ {arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}] + runs-on: ${{ matrix.builder.os }} + name: Test ${{ matrix.php_version }}-${{ matrix.variant }} ${{ matrix.builder.arch }} only steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Docker + # /!\ this action is marked as experimental + # It's required only for macos + if: ${{ matrix.builder.os == 'macos-latest' }} + uses: docker-practice/actions-setup-docker@master - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 + - name: Build + run: | + PHP_VERSION="${{ matrix.php_version }}" + TAG_PREFIX="rc${GITHUB_SHA::7}-" \ + docker buildx bake \ + --set "*.platform=linux/${{ matrix.builder.arch }}" \ + --set "*.output=type=docker" \ + --load \ + php${PHP_VERSION//.}-${{ matrix.variant }}-all + - name: Display tags built + run: | + docker image ls --filter="reference=thecodingmachine/php" --format "{{.CreatedAt}}\t{{.Size}}\t{{.Repository}}:{{.Tag}}" + - name: Test + run: | + TAG_PREFIX="rc${GITHUB_SHA::7}-" \ + PHP_VERSION="${{ matrix.php_version }}" \ + BRANCH="v4" \ + VARIANT="${{ matrix.variant }}" \ + PLATFORM="linux/${{ matrix.builder.arch }}" \ + ./tests-suite/bash_unit -f tap ./tests-suite/*.sh + + publish: + # push ~ schedule + if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} + needs: + - test + runs-on: ubuntu-latest + name: Publish ${{ matrix.php_version }}-${{ matrix.variant }} multi-arch to dockerhub + strategy: + fail-fast: false + matrix: + php_version: ['8.1','8.0','7.4', '7.3','7.2'] + variant: ['apache','cli','fpm'] + steps: - name: Checkout - uses: actions/checkout@v1 -# - name: Build locally -# run: | -# PHP_VERSION="${{ matrix.php_version }}" -# docker buildx bake --load \ -# --set "*.platform=linux/amd64" \ -# php${PHP_VERSION//.}-slim-${{ matrix.variant }} -# docker buildx bake --load \ -# --set "*.platform=linux/amd64" \ -# php${PHP_VERSION//.}-${{ matrix.variant }}-all -# 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` -# echo "PHP_VERSION_MINOR=${PHP_VERSION_MINOR}" >> $GITHUB_ENV -# echo "PHP Version : ${PHP_VERSION_MINOR}" >> $GITHUB_STEP_SUMMARY -# docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY -# - name: Test ${{ matrix.variant }} -# run: | -# PHP_VERSION="${{ matrix.php_version }}" BRANCH=v4 VARIANT=${{ matrix.variant }} ./test-image.sh -# echo "${{ matrix.variant }} variant OK" >> $GITHUB_STEP_SUMMARY + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 - name: Login to DockerHub - # Merge ~ push. - if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push to repository - # Merge ~ push. - if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} + - name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with tagged prefix run: | PHP_VERSION="${{ matrix.php_version }}" + TAG_PREFIX="rc${GITHUB_SHA::7}-" \ docker buildx bake \ --set "*.platform=linux/amd64,linux/arm64" \ --set "*.output=type=registry" \ - php${PHP_VERSION//.}-slim-${{ matrix.variant }} - 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` \ + php${PHP_VERSION//.}-${{ matrix.variant }}-all + - name: Fetch minor version of php + run: | + # Retrieve minor version + 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` + echo "PHP_PATCH_MINOR=${PHP_PATCH_MINOR}" >> $GITHUB_ENV + - name: Build and push ${{ matrix.php_version }}-${{ matrix.variant }} with releases tags (major and minor) + run: | + PHP_VERSION="${{ matrix.php_version }}" + PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \ docker buildx bake \ --set "*.platform=linux/amd64,linux/arm64" \ --set "*.output=type=registry" \ + --metadata-file "/tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log" php${PHP_VERSION//.}-${{ matrix.variant }}-all - docker images --filter=reference=thecodingmachine/php >> $GITHUB_STEP_SUMMARY + - name: Artifacts + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.php_version }}-${{ matrix.variant }} + path: /tmp/digests-php${PHP_VERSION//.}-${{ matrix.variant }}.log + retention-days: 60 + - name: Display tags built + run: | + echo "With prefix :" + TAG_PREFIX="rc${GITHUB_SHA::7}-" \ + docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r + echo "-----" + echo "Regular :" + PHP_PATCH_MINOR="${PHP_VERSION_MINOR}" \ + docker buildx bake php${PHP_VERSION//.}-${{ matrix.variant }}-all --print --progress plain | jq ".target[].tags | join(\" \")" -r + diff --git a/.gitignore b/.gitignore index 48e1dca8..723ef36f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -.idea -tmp \ No newline at end of file +.idea \ No newline at end of file diff --git a/Dockerfile.apache b/Dockerfile.apache index 05196e97..99bacba5 100644 --- a/Dockerfile.apache +++ b/Dockerfile.apache @@ -1,11 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache as baseapp +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-apache" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH diff --git a/Dockerfile.apache.node14 b/Dockerfile.apache.node similarity index 65% rename from Dockerfile.apache.node14 rename to Dockerfile.apache.node index 49a006f8..7e69988a 100644 --- a/Dockerfile.apache.node14 +++ b/Dockerfile.apache.node @@ -1,10 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}:${PHP_VERSION}-${GLOBAL_VERSION}-apache" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 +ARG NODE_VERSION=16 USER root @@ -12,14 +18,14 @@ ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} RUN apt-get update && \ apt-get install -y --no-install-recommends gnupg && \ - curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_${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 [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* diff --git a/Dockerfile.apache.node16 b/Dockerfile.apache.node16 deleted file mode 100644 index 8bf14ef2..00000000 --- a/Dockerfile.apache.node16 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_16.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.cli b/Dockerfile.cli index 1d64507a..8aaedf43 100644 --- a/Dockerfile.cli +++ b/Dockerfile.cli @@ -1,11 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli as baseapp +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-cli" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH diff --git a/Dockerfile.apache.node10 b/Dockerfile.cli.node similarity index 66% rename from Dockerfile.apache.node10 rename to Dockerfile.cli.node index a3752a81..77437d7c 100644 --- a/Dockerfile.apache.node10 +++ b/Dockerfile.cli.node @@ -1,10 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}:${PHP_VERSION}-${GLOBAL_VERSION}-cli" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 +ARG NODE_VERSION=16 USER root @@ -12,14 +18,14 @@ ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} RUN apt-get update && \ apt-get install -y --no-install-recommends gnupg && \ - curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_${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@^6.14 && \ + if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* diff --git a/Dockerfile.cli.node10 b/Dockerfile.cli.node10 deleted file mode 100644 index b4c7fd15..00000000 --- a/Dockerfile.cli.node10 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_10.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@^6.14 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.cli.node12 b/Dockerfile.cli.node12 deleted file mode 100644 index 52fe4208..00000000 --- a/Dockerfile.cli.node12 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_12.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.cli.node14 b/Dockerfile.cli.node14 deleted file mode 100644 index 2be12c05..00000000 --- a/Dockerfile.cli.node14 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_14.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.cli.node16 b/Dockerfile.cli.node16 deleted file mode 100644 index bcb17561..00000000 --- a/Dockerfile.cli.node16 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_16.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.fpm b/Dockerfile.fpm index f139b82c..ed56eb92 100644 --- a/Dockerfile.fpm +++ b/Dockerfile.fpm @@ -1,11 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-fpm as baseapp +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-fpm" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH diff --git a/Dockerfile.apache.node12 b/Dockerfile.fpm.node similarity index 66% rename from Dockerfile.apache.node12 rename to Dockerfile.fpm.node index 22df0156..abd50c2f 100644 --- a/Dockerfile.apache.node12 +++ b/Dockerfile.fpm.node @@ -1,10 +1,16 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-apache as baseapp +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}:${PHP_VERSION}-${GLOBAL_VERSION}-fpm" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 +ARG NODE_VERSION=16 USER root @@ -12,14 +18,14 @@ ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} RUN apt-get update && \ apt-get install -y --no-install-recommends gnupg && \ - curl -sL https://deb.nodesource.com/setup_12.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_${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 [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* diff --git a/Dockerfile.fpm.node10 b/Dockerfile.fpm.node10 deleted file mode 100644 index c3bf8634..00000000 --- a/Dockerfile.fpm.node10 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_10.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@^6.14 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.fpm.node12 b/Dockerfile.fpm.node12 deleted file mode 100644 index 76414521..00000000 --- a/Dockerfile.fpm.node12 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_12.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.fpm.node14 b/Dockerfile.fpm.node14 deleted file mode 100644 index 459a6639..00000000 --- a/Dockerfile.fpm.node14 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_14.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.fpm.node16 b/Dockerfile.fpm.node16 deleted file mode 100644 index ff34925f..00000000 --- a/Dockerfile.fpm.node16 +++ /dev/null @@ -1,26 +0,0 @@ -# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) -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 - -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_16.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 && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* - -USER docker diff --git a/Dockerfile.slim.apache b/Dockerfile.slim.apache index 78f32a1d..3d47ff3c 100644 --- a/Dockerfile.slim.apache +++ b/Dockerfile.slim.apache @@ -1,6 +1,8 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Fixes some weird terminal issues such as broken clear / CTRL+L #ENV TERM=linux @@ -53,7 +55,6 @@ RUN apt-get update \ php${PHP_VERSION}-xml \ php${PHP_VERSION}-zip \ && if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ - && if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* @@ -210,8 +211,8 @@ EXPOSE 80 ENV APACHE_DOCUMENT_ROOT= -RUN sed -ri -e 's!/var/www/html!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf -RUN sed -ri -e 's!/var/www/!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf +RUN sed -ri -e 's!/var/www/html!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \ + sed -ri -e 's!/var/www/!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf # Let's remove the default Apache php.ini file (it will be copied from TEMPLATE_PHP_INI) RUN rm /etc/php/${PHP_VERSION}/apache2/php.ini @@ -254,7 +255,7 @@ USER docker # | We create an empty known_host file and we launch the ssh-agent # | -RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval $(ssh-agent -s) +RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval "$(ssh-agent -s)" # |-------------------------------------------------------------------------- @@ -293,11 +294,12 @@ RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/ ENV IMAGE_VARIANT=apache -# Add Tini (to be able to stop the container with ctrl-c). -# See: https://github.com/krallin/tini -ENV TINI_VERSION v0.16.1 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN chmod +x /tini +## Add Tini (to be able to stop the container with ctrl-c). +## See: https://github.com/krallin/tini +## FIX https://github.com/krallin/tini/pull/67 +#ENV TINI_VERSION v0.19.0 +#ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini +#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 @@ -315,8 +317,8 @@ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] # 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 +RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf && \ + a2enconf servername CMD ["apache2-foreground"] @@ -357,22 +359,21 @@ ONBUILD RUN sudo -E PHP_EXTENSIONS="$PHP_EXTENSIONS" /usr/local/bin/install_sele # | # | Supercronic is a drop-in replacement for cron (for containers). # | -ENV SUPERCRONIC_OPTIONS= +ENV SUPERCRONIC_OPTIONS="" ONBUILD ARG INSTALL_CRON ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ - SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-$TARGETOS-$TARGETARCH \ - && 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 - \ - && chmod +x "$SUPERCRONIC" \ - && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ - && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ - fi; + SUPERCRONIC="supercronic-${TARGETOS}-${TARGETARCH}" \ + && SUPERCRONIC_URL="https://github.com/aptible/supercronic/releases/download/v0.1.9/${SUPERCRONIC}" \ + && echo ${SUPERCRONIC_URL} \ + && if [ "$TARGETARCH" = "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" = "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '${TARGETARCH}' is not supported"; exit 1; fi \ + && curl -fsSLO "${SUPERCRONIC_URL}" \ + && 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; \ + fi # |-------------------------------------------------------------------------- @@ -394,6 +395,7 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \ sudo apt-get update && \ sudo apt-get install -y --no-install-recommends yarn && \ + if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ sudo apt-get clean && \ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*; \ fi; diff --git a/Dockerfile.slim.cli b/Dockerfile.slim.cli index a896705a..817bf938 100644 --- a/Dockerfile.slim.cli +++ b/Dockerfile.slim.cli @@ -1,6 +1,8 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Fixes some weird terminal issues such as broken clear / CTRL+L #ENV TERM=linux @@ -53,7 +55,6 @@ RUN apt-get update \ php${PHP_VERSION}-xml \ php${PHP_VERSION}-zip \ && if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ - && if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* @@ -180,7 +181,7 @@ USER docker # | We create an empty known_host file and we launch the ssh-agent # | -RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval $(ssh-agent -s) +RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval "$(ssh-agent -s)" # |-------------------------------------------------------------------------- @@ -219,11 +220,12 @@ RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/ ENV IMAGE_VARIANT=cli -# Add Tini (to be able to stop the container with ctrl-c). -# See: https://github.com/krallin/tini -ENV TINI_VERSION v0.16.1 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN chmod +x /tini +## Add Tini (to be able to stop the container with ctrl-c). +## See: https://github.com/krallin/tini +## FIX https://github.com/krallin/tini/pull/67 +#ENV TINI_VERSION v0.19.0 +#ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini +#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 @@ -262,22 +264,21 @@ ONBUILD RUN sudo -E PHP_EXTENSIONS="$PHP_EXTENSIONS" /usr/local/bin/install_sele # | # | Supercronic is a drop-in replacement for cron (for containers). # | -ENV SUPERCRONIC_OPTIONS= +ENV SUPERCRONIC_OPTIONS="" ONBUILD ARG INSTALL_CRON ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ - SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-$TARGETOS-$TARGETARCH \ - && 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 - \ - && chmod +x "$SUPERCRONIC" \ - && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ - && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ - fi; + SUPERCRONIC="supercronic-${TARGETOS}-${TARGETARCH}" \ + && SUPERCRONIC_URL="https://github.com/aptible/supercronic/releases/download/v0.1.9/${SUPERCRONIC}" \ + && echo ${SUPERCRONIC_URL} \ + && if [ "$TARGETARCH" = "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" = "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '${TARGETARCH}' is not supported"; exit 1; fi \ + && curl -fsSLO "${SUPERCRONIC_URL}" \ + && 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; \ + fi # |-------------------------------------------------------------------------- @@ -299,6 +300,7 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \ sudo apt-get update && \ sudo apt-get install -y --no-install-recommends yarn && \ + if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ sudo apt-get clean && \ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*; \ fi; diff --git a/Dockerfile.slim.fpm b/Dockerfile.slim.fpm index 2ca98a65..a9b72fa4 100644 --- a/Dockerfile.slim.fpm +++ b/Dockerfile.slim.fpm @@ -1,6 +1,8 @@ +#syntax=docker/dockerfile-upstream:1 # DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint) FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Fixes some weird terminal issues such as broken clear / CTRL+L #ENV TERM=linux @@ -53,7 +55,6 @@ RUN apt-get update \ php${PHP_VERSION}-xml \ php${PHP_VERSION}-zip \ && if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ - && if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* @@ -159,8 +160,8 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* # Let's remove the default PHP-FPM php.ini file (it will be copied from TEMPLATE_PHP_INI) -RUN rm /etc/php/${PHP_VERSION}/fpm/php.ini -RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm +RUN rm /etc/php/${PHP_VERSION}/fpm/php.ini && \ + ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm COPY utils/fpm-docker.conf /etc/php/${PHP_VERSION}/fpm/pool.d/docker.conf COPY utils/fpm-zz-docker.conf /etc/php/${PHP_VERSION}/fpm/pool.d/zz-docker.conf @@ -193,7 +194,7 @@ USER docker # | We create an empty known_host file and we launch the ssh-agent # | -RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval $(ssh-agent -s) +RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval "$(ssh-agent -s)" # |-------------------------------------------------------------------------- @@ -232,11 +233,12 @@ RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/ ENV IMAGE_VARIANT=fpm -# Add Tini (to be able to stop the container with ctrl-c). -# See: https://github.com/krallin/tini -ENV TINI_VERSION v0.16.1 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN chmod +x /tini +## Add Tini (to be able to stop the container with ctrl-c). +## See: https://github.com/krallin/tini +## FIX https://github.com/krallin/tini/pull/67 +#ENV TINI_VERSION v0.19.0 +#ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini +#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 @@ -264,7 +266,7 @@ RUN ln -s /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini /etc/php/${P sed -i 's/^group = www-data/;group = www-data/g' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \ sed -i 's#listen = /run/php/php${PHP_VERSION}-fpm.sock#;listen = /run/php/php${PHP_VERSION}-fpm.sock#g' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \ sed -i "s#pid = /run/php/php${PHP_VERSION}-fpm.pid#;pid = /run/php/php${PHP_VERSION}-fpm.pid#g" /etc/php/${PHP_VERSION}/fpm/php-fpm.conf && \ - if [ "$PHP_VERSION" = "7.2" ]; then \ + if [[ "$PHP_VERSION" = "7.2" ]]; then \ sed -i 's/^log_limit =/;log_limit =/g' /etc/php/${PHP_VERSION}/fpm/pool.d/docker.conf && \ sed -i 's/^decorate_workers_output =/;decorate_workers_output =/g' /etc/php/${PHP_VERSION}/fpm/pool.d/docker.conf; \ fi @@ -285,22 +287,21 @@ ONBUILD RUN sudo -E PHP_EXTENSIONS="$PHP_EXTENSIONS" /usr/local/bin/install_sele # | # | Supercronic is a drop-in replacement for cron (for containers). # | -ENV SUPERCRONIC_OPTIONS= +ENV SUPERCRONIC_OPTIONS="" ONBUILD ARG INSTALL_CRON ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ - SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-$TARGETOS-$TARGETARCH \ - && 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 - \ - && chmod +x "$SUPERCRONIC" \ - && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ - && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ - fi; + SUPERCRONIC="supercronic-${TARGETOS}-${TARGETARCH}" \ + && SUPERCRONIC_URL="https://github.com/aptible/supercronic/releases/download/v0.1.9/${SUPERCRONIC}" \ + && echo ${SUPERCRONIC_URL} \ + && if [ "$TARGETARCH" = "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" = "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '${TARGETARCH}' is not supported"; exit 1; fi \ + && curl -fsSLO "${SUPERCRONIC_URL}" \ + && 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; \ + fi # |-------------------------------------------------------------------------- @@ -322,6 +323,7 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \ sudo apt-get update && \ sudo apt-get install -y --no-install-recommends yarn && \ + if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ sudo apt-get clean && \ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*; \ fi; diff --git a/Makefile b/Makefile index 71f16929..e672b4dc 100644 --- a/Makefile +++ b/Makefile @@ -16,16 +16,18 @@ test-quick: ## Test 8.0 and 8.1 quickly test-8.1: ## Test php8.1 build only VERSION=8.1 VARIANT=cli $(MAKE) _test-version VERSION=8.1 VARIANT=apache $(MAKE) _test-version + VERSION=8.1 VARIANT=fpm $(MAKE) _test-version test-8.0: ## Test php8.0 build only VERSION=8.0 VARIANT=cli $(MAKE) _test-version VERSION=8.0 VARIANT=apache $(MAKE) _test-version + VERSION=8.0 VARIANT=fpm $(MAKE) _test-version _test-version: _test-prerequisites ## Test php build for VERSION="" and VARIANT="" docker buildx bake --load \ --set "*.platform=$$(uname -p)" \ - php$${VERSION//.}-cli - PHP_VERSION="$(VERSION)" BRANCH=v4 VARIANT=cli ./test-image.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT))" && exit 1) + php$${VERSION//.}-$(VARIANT)-all + PHP_VERSION="$(VERSION)" BRANCH=v4 VARIANT=$(VARIANT) ./tests-suite/bash_unit -f tap ./tests-suite/*.sh || (notify-send -u critical "Tests failed ($(VERSION)-$(VARIANT))" && exit 1) notify-send -u critical "Tests passed with success ($(VERSION)-$(VARIANT))" clean: ## Clean dangles image after build diff --git a/README.md b/README.md index 4301d32d..fcca6142 100644 --- a/README.md +++ b/README.md @@ -185,9 +185,9 @@ This list can be outdated, you can verify by executing : `docker run --rm -it th - *mcrypt* is not available anymore in PHP 7.3+ - *weakref* is not compatible with PHP 7.3+ (but weak references were added to the PHP core in PHP 7.4) -- *sybase* extension is not available in v4 (use v3) - *event*, *gnupg* are not available in PHP 8.0+ -- *blackfire*, *gettext*, *ev*, *rdkafka*, *swoole* are not available in PHP 8.1+ +- *gettext*, *ev*, *rdkafka*, *swoole* are not available in PHP 8.1+ +- *ev*, *rdkafka*, *snmp*, *swoole* are not available in all `ARM64` images (build time is too long : it's possible to install manually as required) ### Enabling/disabling extensions in the fat image diff --git a/docker-bake.hcl b/docker-bake.hcl index 138030f8..2b321b7f 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -135,14 +135,15 @@ group "php72" { } variable "REPO" {default = "thecodingmachine/php"} +variable "TAG_PREFIX" {default = ""} variable "PHP_PATCH_MINOR" {default = ""} variable "GLOBAL_VERSION" {default = "v4"} function "tag" { - params = [PHP_VERSION, VARIANT, PHP_MINOR] + params = [PHP_VERSION, VARIANT] result = [ - "${REPO}:${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}", - notequal("",PHP_MINOR) ? "${REPO}:${PHP_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "", + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}", + notequal("",PHP_PATCH_MINOR) ? "${REPO}:${TAG_PREFIX}${PHP_PATCH_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "", ] } @@ -151,13 +152,10 @@ target "default" { args = { GLOBAL_VERSION = "${GLOBAL_VERSION}" } - platforms = ["linux/amd64"] + #platforms = ["linux/amd64", "linux/arm64"] + platforms = [BAKE_LOCAL_PLATFORM] pull = true - #output = ["customDir"] - #output = ["type=tar,dest=myimage.tar"] - output = ["type=docker"] # load in local docker - #output = ["type=registry"] # push - #output = ["type=image"] # push also ? + output = ["type=docker"] # export in local docker } @@ -167,7 +165,7 @@ target "default" { # thecodingmachine/php:8.1-v4-slim-apache target "php81-slim-apache" { inherits = ["default"] - tags = tag("8.1", "slim-apache", "${PHP_PATCH_MINOR}") + tags = tag("8.1", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { PHP_VERSION = "8.1" @@ -177,71 +175,80 @@ 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}") + tags = tag("8.1", "apache") dockerfile = "Dockerfile.apache" args = { PHP_VERSION = "8.1" VARIANT = "apache" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php81-slim-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" + tags = tag("8.1", "apache-node16") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.1" VARIANT = "apache-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php81-apache" } } # 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" + tags = tag("8.1", "apache-node14") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.1" VARIANT = "apache-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php81-apache" } } # 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" + tags = tag("8.1", "apache-node12") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.1" VARIANT = "apache-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php81-apache" } } # 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" + tags = tag("8.1", "apache-node10") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.1" VARIANT = "apache-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php81-apache" } } @@ -251,7 +258,7 @@ target "php81-apache-node10" { # thecodingmachine/php:8.1-v4-slim-fpm target "php81-slim-fpm" { inherits = ["default"] - tags = tag("8.1", "slim-fpm", "${PHP_PATCH_MINOR}") + tags = tag("8.1", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { PHP_VERSION = "8.1" @@ -261,71 +268,80 @@ 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}") + tags = tag("8.1", "fpm") dockerfile = "Dockerfile.fpm" args = { PHP_VERSION = "8.1" VARIANT = "fpm" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php81-slim-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" + tags = tag("8.1", "fpm-node16") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.1" VARIANT = "fpm-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php81-fpm" } } # 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" + tags = tag("8.1", "fpm-node14") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.1" VARIANT = "fpm-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php81-fpm" } } # 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" + tags = tag("8.1", "fpm-node12") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.1" VARIANT = "fpm-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php81-fpm" } } # 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" + tags = tag("8.1", "fpm-node10") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.1" VARIANT = "fpm-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php81-fpm" } } @@ -335,7 +351,7 @@ target "php81-fpm-node10" { # thecodingmachine/php:8.1-v4-slim-cli target "php81-slim-cli" { inherits = ["default"] - tags = tag("8.1", "slim-cli", "${PHP_PATCH_MINOR}") + tags = tag("8.1", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { PHP_VERSION = "8.1" @@ -345,71 +361,80 @@ 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}") + tags = tag("8.1", "cli") dockerfile = "Dockerfile.cli" args = { PHP_VERSION = "8.1" VARIANT = "cli" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php81-slim-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" + tags = tag("8.1", "cli-node16") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.1" VARIANT = "cli-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php81-cli" } } # 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" + tags = tag("8.1", "cli-node14") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.1" VARIANT = "cli-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php81-cli" } } # 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" + tags = tag("8.1", "cli-node12") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.1" VARIANT = "cli-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php81-cli" } } # 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" + tags = tag("8.1", "cli-node10") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.1" VARIANT = "cli-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php81-cli" } } @@ -419,7 +444,7 @@ target "php81-cli-node10" { # thecodingmachine/php:8.0-v4-slim-apache target "php80-slim-apache" { inherits = ["default"] - tags = tag("8.0", "slim-apache", "${PHP_PATCH_MINOR}") + tags = tag("8.0", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { PHP_VERSION = "8.0" @@ -429,71 +454,80 @@ 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}") + tags = tag("8.0", "apache") dockerfile = "Dockerfile.apache" args = { PHP_VERSION = "8.0" VARIANT = "apache" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php80-slim-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" + tags = tag("8.0", "apache-node16") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.0" VARIANT = "apache-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php80-apache" } } # 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" + tags = tag("8.0", "apache-node14") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.0" VARIANT = "apache-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php80-apache" } } # 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" + tags = tag("8.0", "apache-node12") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.0" VARIANT = "apache-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php80-apache" } } # 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" + tags = tag("8.0", "apache-node10") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "8.0" VARIANT = "apache-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php80-apache" } } @@ -503,7 +537,7 @@ target "php80-apache-node10" { # thecodingmachine/php:8.0-v4-slim-fpm target "php80-slim-fpm" { inherits = ["default"] - tags = tag("8.0", "slim-fpm", "${PHP_PATCH_MINOR}") + tags = tag("8.0", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { PHP_VERSION = "8.0" @@ -513,71 +547,80 @@ 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}") + tags = tag("8.0", "fpm") dockerfile = "Dockerfile.fpm" args = { PHP_VERSION = "8.0" VARIANT = "fpm" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php80-slim-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" + tags = tag("8.0", "fpm-node16") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.0" VARIANT = "fpm-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php80-fpm" } } # 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" + tags = tag("8.0", "fpm-node14") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.0" VARIANT = "fpm-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php80-fpm" } } # 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" + tags = tag("8.0", "fpm-node12") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.0" VARIANT = "fpm-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php80-fpm" } } # 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" + tags = tag("8.0", "fpm-node10") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "8.0" VARIANT = "fpm-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php80-fpm" } } @@ -587,7 +630,7 @@ target "php80-fpm-node10" { # thecodingmachine/php:8.0-v4-slim-cli target "php80-slim-cli" { inherits = ["default"] - tags = tag("8.0", "slim-cli", "${PHP_PATCH_MINOR}") + tags = tag("8.0", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { PHP_VERSION = "8.0" @@ -597,71 +640,80 @@ 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}") + tags = tag("8.0", "cli") dockerfile = "Dockerfile.cli" args = { PHP_VERSION = "8.0" VARIANT = "cli" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php80-slim-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" + tags = tag("8.0", "cli-node16") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.0" VARIANT = "cli-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php80-cli" } } # 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" + tags = tag("8.0", "cli-node14") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.0" VARIANT = "cli-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php80-cli" } } # 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" + tags = tag("8.0", "cli-node12") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.0" VARIANT = "cli-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php80-cli" } } # 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" + tags = tag("8.0", "cli-node10") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "8.0" VARIANT = "cli-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php80-cli" } } @@ -671,7 +723,7 @@ target "php80-cli-node10" { # thecodingmachine/php:7.4-v4-slim-apache target "php74-slim-apache" { inherits = ["default"] - tags = tag("7.4", "slim-apache", "${PHP_PATCH_MINOR}") + tags = tag("7.4", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { PHP_VERSION = "7.4" @@ -681,71 +733,80 @@ 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}") + tags = tag("7.4", "apache") dockerfile = "Dockerfile.apache" args = { PHP_VERSION = "7.4" VARIANT = "apache" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php74-slim-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" + tags = tag("7.4", "apache-node16") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.4" VARIANT = "apache-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php74-apache" } } # 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" + tags = tag("7.4", "apache-node14") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.4" VARIANT = "apache-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php74-apache" } } # 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" + tags = tag("7.4", "apache-node12") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.4" VARIANT = "apache-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php74-apache" } } # 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" + tags = tag("7.4", "apache-node10") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.4" VARIANT = "apache-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php74-apache" } } @@ -755,7 +816,7 @@ target "php74-apache-node10" { # thecodingmachine/php:7.4-v4-slim-fpm target "php74-slim-fpm" { inherits = ["default"] - tags = tag("7.4", "slim-fpm", "${PHP_PATCH_MINOR}") + tags = tag("7.4", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { PHP_VERSION = "7.4" @@ -765,71 +826,80 @@ 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}") + tags = tag("7.4", "fpm") dockerfile = "Dockerfile.fpm" args = { PHP_VERSION = "7.4" VARIANT = "fpm" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php74-slim-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" + tags = tag("7.4", "fpm-node16") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.4" VARIANT = "fpm-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php74-fpm" } } # 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" + tags = tag("7.4", "fpm-node14") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.4" VARIANT = "fpm-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php74-fpm" } } # 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" + tags = tag("7.4", "fpm-node12") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.4" VARIANT = "fpm-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php74-fpm" } } # 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" + tags = tag("7.4", "fpm-node10") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.4" VARIANT = "fpm-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php74-fpm" } } @@ -839,7 +909,7 @@ target "php74-fpm-node10" { # thecodingmachine/php:7.4-v4-slim-cli target "php74-slim-cli" { inherits = ["default"] - tags = tag("7.4", "slim-cli", "${PHP_PATCH_MINOR}") + tags = tag("7.4", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { PHP_VERSION = "7.4" @@ -849,71 +919,80 @@ 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}") + tags = tag("7.4", "cli") dockerfile = "Dockerfile.cli" args = { PHP_VERSION = "7.4" VARIANT = "cli" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php74-slim-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" + tags = tag("7.4", "cli-node16") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.4" VARIANT = "cli-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php74-cli" } } # 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" + tags = tag("7.4", "cli-node14") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.4" VARIANT = "cli-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php74-cli" } } # 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" + tags = tag("7.4", "cli-node12") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.4" VARIANT = "cli-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php74-cli" } } # 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" + tags = tag("7.4", "cli-node10") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.4" VARIANT = "cli-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php74-cli" } } @@ -923,7 +1002,7 @@ target "php74-cli-node10" { # thecodingmachine/php:7.3-v4-slim-apache target "php73-slim-apache" { inherits = ["default"] - tags = tag("7.3", "slim-apache", "${PHP_PATCH_MINOR}") + tags = tag("7.3", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { PHP_VERSION = "7.3" @@ -933,71 +1012,80 @@ 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}") + tags = tag("7.3", "apache") dockerfile = "Dockerfile.apache" args = { PHP_VERSION = "7.3" VARIANT = "apache" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php73-slim-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" + tags = tag("7.3", "apache-node16") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.3" VARIANT = "apache-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php73-apache" } } # 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" + tags = tag("7.3", "apache-node14") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.3" VARIANT = "apache-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php73-apache" } } # 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" + tags = tag("7.3", "apache-node12") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.3" VARIANT = "apache-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php73-apache" } } # 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" + tags = tag("7.3", "apache-node10") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.3" VARIANT = "apache-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php73-apache" } } @@ -1007,7 +1095,7 @@ target "php73-apache-node10" { # thecodingmachine/php:7.3-v4-slim-fpm target "php73-slim-fpm" { inherits = ["default"] - tags = tag("7.3", "slim-fpm", "${PHP_PATCH_MINOR}") + tags = tag("7.3", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { PHP_VERSION = "7.3" @@ -1017,71 +1105,80 @@ 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}") + tags = tag("7.3", "fpm") dockerfile = "Dockerfile.fpm" args = { PHP_VERSION = "7.3" VARIANT = "fpm" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php73-slim-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" + tags = tag("7.3", "fpm-node16") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.3" VARIANT = "fpm-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php73-fpm" } } # 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" + tags = tag("7.3", "fpm-node14") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.3" VARIANT = "fpm-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php73-fpm" } } # 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" + tags = tag("7.3", "fpm-node12") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.3" VARIANT = "fpm-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php73-fpm" } } # 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" + tags = tag("7.3", "fpm-node10") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.3" VARIANT = "fpm-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php73-fpm" } } @@ -1091,7 +1188,7 @@ target "php73-fpm-node10" { # thecodingmachine/php:7.3-v4-slim-cli target "php73-slim-cli" { inherits = ["default"] - tags = tag("7.3", "slim-cli", "${PHP_PATCH_MINOR}") + tags = tag("7.3", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { PHP_VERSION = "7.3" @@ -1101,71 +1198,80 @@ 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}") + tags = tag("7.3", "cli") dockerfile = "Dockerfile.cli" args = { PHP_VERSION = "7.3" VARIANT = "cli" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php73-slim-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" + tags = tag("7.3", "cli-node16") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.3" VARIANT = "cli-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php73-cli" } } # 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" + tags = tag("7.3", "cli-node14") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.3" VARIANT = "cli-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php73-cli" } } # 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" + tags = tag("7.3", "cli-node12") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.3" VARIANT = "cli-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php73-cli" } } # 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" + tags = tag("7.3", "cli-node10") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.3" VARIANT = "cli-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php73-cli" } } @@ -1175,7 +1281,7 @@ target "php73-cli-node10" { # thecodingmachine/php:7.2-v4-slim-apache target "php72-slim-apache" { inherits = ["default"] - tags = tag("7.2", "slim-apache", "${PHP_PATCH_MINOR}") + tags = tag("7.2", "slim-apache") dockerfile = "Dockerfile.slim.apache" args = { PHP_VERSION = "7.2" @@ -1185,71 +1291,80 @@ 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}") + tags = tag("7.2", "apache") dockerfile = "Dockerfile.apache" args = { PHP_VERSION = "7.2" VARIANT = "apache" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php72-slim-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" + tags = tag("7.2", "apache-node16") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.2" VARIANT = "apache-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php72-apache" } } # 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" + tags = tag("7.2", "apache-node14") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.2" VARIANT = "apache-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php72-apache" } } # 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" + tags = tag("7.2", "apache-node12") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.2" VARIANT = "apache-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php72-apache" } } # 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" + tags = tag("7.2", "apache-node10") + dockerfile = "Dockerfile.apache.node" args = { PHP_VERSION = "7.2" VARIANT = "apache-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php72-apache" } } @@ -1259,7 +1374,7 @@ target "php72-apache-node10" { # thecodingmachine/php:7.2-v4-slim-fpm target "php72-slim-fpm" { inherits = ["default"] - tags = tag("7.2", "slim-fpm", "${PHP_PATCH_MINOR}") + tags = tag("7.2", "slim-fpm") dockerfile = "Dockerfile.slim.fpm" args = { PHP_VERSION = "7.2" @@ -1269,71 +1384,80 @@ 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}") + tags = tag("7.2", "fpm") dockerfile = "Dockerfile.fpm" args = { PHP_VERSION = "7.2" VARIANT = "fpm" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php72-slim-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" + tags = tag("7.2", "fpm-node16") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.2" VARIANT = "fpm-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php72-fpm" } } # 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" + tags = tag("7.2", "fpm-node14") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.2" VARIANT = "fpm-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php72-fpm" } } # 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" + tags = tag("7.2", "fpm-node12") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.2" VARIANT = "fpm-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php72-fpm" } } # 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" + tags = tag("7.2", "fpm-node10") + dockerfile = "Dockerfile.fpm.node" args = { PHP_VERSION = "7.2" VARIANT = "fpm-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php72-fpm" } } @@ -1343,7 +1467,7 @@ target "php72-fpm-node10" { # thecodingmachine/php:7.2-v4-slim-cli target "php72-slim-cli" { inherits = ["default"] - tags = tag("7.2", "slim-cli", "${PHP_PATCH_MINOR}") + tags = tag("7.2", "slim-cli") dockerfile = "Dockerfile.slim.cli" args = { PHP_VERSION = "7.2" @@ -1353,71 +1477,80 @@ 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}") + tags = tag("7.2", "cli") dockerfile = "Dockerfile.cli" args = { PHP_VERSION = "7.2" VARIANT = "cli" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php72-slim-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" + tags = tag("7.2", "cli-node16") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.2" VARIANT = "cli-node16" + FROM_IMAGE = "fat" + NODE_VERSION = "16" + } + contexts = { + fat = "target:php72-cli" } } # 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" + tags = tag("7.2", "cli-node14") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.2" VARIANT = "cli-node14" + FROM_IMAGE = "fat" + NODE_VERSION = "14" + } + contexts = { + fat = "target:php72-cli" } } # 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" + tags = tag("7.2", "cli-node12") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.2" VARIANT = "cli-node12" + FROM_IMAGE = "fat" + NODE_VERSION = "12" + } + contexts = { + fat = "target:php72-cli" } } # 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" + tags = tag("7.2", "cli-node10") + dockerfile = "Dockerfile.cli.node" args = { PHP_VERSION = "7.2" VARIANT = "cli-node10" + FROM_IMAGE = "fat" + NODE_VERSION = "10" + } + contexts = { + fat = "target:php72-cli" } } diff --git a/extensions/7.2/imagick b/extensions/7.2/imagick index 308094fe..a55b99bc 120000 --- a/extensions/7.2/imagick +++ b/extensions/7.2/imagick @@ -1 +1 @@ -../core/imagick/ \ No newline at end of file +../core/imagick \ No newline at end of file diff --git a/extensions/7.2/mysqli b/extensions/7.2/mysqli index f752c283..401b7fbf 120000 --- a/extensions/7.2/mysqli +++ b/extensions/7.2/mysqli @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/7.2/pdo_dblib b/extensions/7.2/pdo_dblib new file mode 120000 index 00000000..2261140c --- /dev/null +++ b/extensions/7.2/pdo_dblib @@ -0,0 +1 @@ +../core/pdo_dblib \ No newline at end of file diff --git a/extensions/7.2/pdo_mysql b/extensions/7.2/pdo_mysql index f752c283..401b7fbf 120000 --- a/extensions/7.2/pdo_mysql +++ b/extensions/7.2/pdo_mysql @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/7.2/pdo_pgsql b/extensions/7.2/pdo_pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/7.2/pdo_pgsql +++ b/extensions/7.2/pdo_pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/7.2/pdo_sqlite b/extensions/7.2/pdo_sqlite index 45ffc754..84c26578 120000 --- a/extensions/7.2/pdo_sqlite +++ b/extensions/7.2/pdo_sqlite @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/7.2/pgsql b/extensions/7.2/pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/7.2/pgsql +++ b/extensions/7.2/pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/7.2/sqlite3 b/extensions/7.2/sqlite3 index abddf395..84c26578 120000 --- a/extensions/7.2/sqlite3 +++ b/extensions/7.2/sqlite3 @@ -1 +1 @@ -../core/sqlite3/ \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/7.2/uploadprogress b/extensions/7.2/uploadprogress index b18aa3c5..6b4b74d0 120000 --- a/extensions/7.2/uploadprogress +++ b/extensions/7.2/uploadprogress @@ -1 +1 @@ -../core/uploadprogress/ \ No newline at end of file +../core/uploadprogress \ No newline at end of file diff --git a/extensions/7.2/uuid b/extensions/7.2/uuid index 2e96802e..7a522046 120000 --- a/extensions/7.2/uuid +++ b/extensions/7.2/uuid @@ -1 +1 @@ -../core/uuid/ \ No newline at end of file +../core/uuid \ No newline at end of file diff --git a/extensions/7.2/zip b/extensions/7.2/zip new file mode 120000 index 00000000..98c05831 --- /dev/null +++ b/extensions/7.2/zip @@ -0,0 +1 @@ +../core/zip \ No newline at end of file diff --git a/extensions/7.3/amqp b/extensions/7.3/amqp index 67752699..f66005fc 120000 --- a/extensions/7.3/amqp +++ b/extensions/7.3/amqp @@ -1 +1 @@ -../core/amqp/ \ No newline at end of file +../core/amqp \ No newline at end of file diff --git a/extensions/7.3/imagick b/extensions/7.3/imagick index 308094fe..a55b99bc 120000 --- a/extensions/7.3/imagick +++ b/extensions/7.3/imagick @@ -1 +1 @@ -../core/imagick/ \ No newline at end of file +../core/imagick \ No newline at end of file diff --git a/extensions/7.3/mysqli b/extensions/7.3/mysqli index f752c283..401b7fbf 120000 --- a/extensions/7.3/mysqli +++ b/extensions/7.3/mysqli @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/7.3/pdo_dblib b/extensions/7.3/pdo_dblib new file mode 120000 index 00000000..2261140c --- /dev/null +++ b/extensions/7.3/pdo_dblib @@ -0,0 +1 @@ +../core/pdo_dblib \ No newline at end of file diff --git a/extensions/7.3/pdo_mysql b/extensions/7.3/pdo_mysql index f752c283..401b7fbf 120000 --- a/extensions/7.3/pdo_mysql +++ b/extensions/7.3/pdo_mysql @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/7.3/pdo_pgsql b/extensions/7.3/pdo_pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/7.3/pdo_pgsql +++ b/extensions/7.3/pdo_pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/7.3/pdo_sqlite b/extensions/7.3/pdo_sqlite index 45ffc754..84c26578 120000 --- a/extensions/7.3/pdo_sqlite +++ b/extensions/7.3/pdo_sqlite @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/7.3/pgsql b/extensions/7.3/pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/7.3/pgsql +++ b/extensions/7.3/pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/7.3/rdkafka b/extensions/7.3/rdkafka index 8fce5d9f..c9f5ff17 120000 --- a/extensions/7.3/rdkafka +++ b/extensions/7.3/rdkafka @@ -1 +1 @@ -../core/rdkafka/ \ No newline at end of file +../core/rdkafka \ No newline at end of file diff --git a/extensions/7.3/sqlite3 b/extensions/7.3/sqlite3 index abddf395..84c26578 120000 --- a/extensions/7.3/sqlite3 +++ b/extensions/7.3/sqlite3 @@ -1 +1 @@ -../core/sqlite3/ \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/7.3/uploadprogress b/extensions/7.3/uploadprogress index b18aa3c5..6b4b74d0 120000 --- a/extensions/7.3/uploadprogress +++ b/extensions/7.3/uploadprogress @@ -1 +1 @@ -../core/uploadprogress/ \ No newline at end of file +../core/uploadprogress \ No newline at end of file diff --git a/extensions/7.3/uuid b/extensions/7.3/uuid index 2e96802e..7a522046 120000 --- a/extensions/7.3/uuid +++ b/extensions/7.3/uuid @@ -1 +1 @@ -../core/uuid/ \ No newline at end of file +../core/uuid \ No newline at end of file diff --git a/extensions/7.3/zip b/extensions/7.3/zip new file mode 120000 index 00000000..98c05831 --- /dev/null +++ b/extensions/7.3/zip @@ -0,0 +1 @@ +../core/zip \ No newline at end of file diff --git a/extensions/7.4/mysqli b/extensions/7.4/mysqli index f752c283..401b7fbf 120000 --- a/extensions/7.4/mysqli +++ b/extensions/7.4/mysqli @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/7.4/pdo_dblib b/extensions/7.4/pdo_dblib new file mode 120000 index 00000000..2261140c --- /dev/null +++ b/extensions/7.4/pdo_dblib @@ -0,0 +1 @@ +../core/pdo_dblib \ No newline at end of file diff --git a/extensions/7.4/pdo_mysql b/extensions/7.4/pdo_mysql index f752c283..401b7fbf 120000 --- a/extensions/7.4/pdo_mysql +++ b/extensions/7.4/pdo_mysql @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/7.4/pdo_pgsql b/extensions/7.4/pdo_pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/7.4/pdo_pgsql +++ b/extensions/7.4/pdo_pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/7.4/pdo_sqlite b/extensions/7.4/pdo_sqlite index 45ffc754..84c26578 120000 --- a/extensions/7.4/pdo_sqlite +++ b/extensions/7.4/pdo_sqlite @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/7.4/pgsql b/extensions/7.4/pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/7.4/pgsql +++ b/extensions/7.4/pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/7.4/sqlite3 b/extensions/7.4/sqlite3 index abddf395..84c26578 120000 --- a/extensions/7.4/sqlite3 +++ b/extensions/7.4/sqlite3 @@ -1 +1 @@ -../core/sqlite3/ \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/7.4/uploadprogress b/extensions/7.4/uploadprogress index b18aa3c5..6b4b74d0 120000 --- a/extensions/7.4/uploadprogress +++ b/extensions/7.4/uploadprogress @@ -1 +1 @@ -../core/uploadprogress/ \ No newline at end of file +../core/uploadprogress \ No newline at end of file diff --git a/extensions/7.4/uuid b/extensions/7.4/uuid index 2e96802e..7a522046 120000 --- a/extensions/7.4/uuid +++ b/extensions/7.4/uuid @@ -1 +1 @@ -../core/uuid/ \ No newline at end of file +../core/uuid \ No newline at end of file diff --git a/extensions/7.4/xdebug b/extensions/7.4/xdebug index ee4c5321..2ee34925 120000 --- a/extensions/7.4/xdebug +++ b/extensions/7.4/xdebug @@ -1 +1 @@ -../core/xdebug/ \ No newline at end of file +../core/xdebug \ No newline at end of file diff --git a/extensions/7.4/zip b/extensions/7.4/zip new file mode 120000 index 00000000..98c05831 --- /dev/null +++ b/extensions/7.4/zip @@ -0,0 +1 @@ +../core/zip \ No newline at end of file diff --git a/extensions/8.0/amqp b/extensions/8.0/amqp index 67752699..f66005fc 120000 --- a/extensions/8.0/amqp +++ b/extensions/8.0/amqp @@ -1 +1 @@ -../core/amqp/ \ No newline at end of file +../core/amqp \ No newline at end of file diff --git a/extensions/8.0/mcrypt b/extensions/8.0/mcrypt index c4321cdf..f548d014 120000 --- a/extensions/8.0/mcrypt +++ b/extensions/8.0/mcrypt @@ -1 +1 @@ -../core/mcrypt-7.1 \ No newline at end of file +../core/mcrypt \ No newline at end of file diff --git a/extensions/8.0/mysqli b/extensions/8.0/mysqli index f752c283..401b7fbf 120000 --- a/extensions/8.0/mysqli +++ b/extensions/8.0/mysqli @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/8.0/pdo_dblib b/extensions/8.0/pdo_dblib new file mode 120000 index 00000000..2261140c --- /dev/null +++ b/extensions/8.0/pdo_dblib @@ -0,0 +1 @@ +../core/pdo_dblib \ No newline at end of file diff --git a/extensions/8.0/pdo_mysql b/extensions/8.0/pdo_mysql index f752c283..401b7fbf 120000 --- a/extensions/8.0/pdo_mysql +++ b/extensions/8.0/pdo_mysql @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/8.0/pdo_pgsql b/extensions/8.0/pdo_pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/8.0/pdo_pgsql +++ b/extensions/8.0/pdo_pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/8.0/pdo_sqlite b/extensions/8.0/pdo_sqlite index 45ffc754..84c26578 120000 --- a/extensions/8.0/pdo_sqlite +++ b/extensions/8.0/pdo_sqlite @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/8.0/pgsql b/extensions/8.0/pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/8.0/pgsql +++ b/extensions/8.0/pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/8.0/sqlite3 b/extensions/8.0/sqlite3 index 45ffc754..84c26578 120000 --- a/extensions/8.0/sqlite3 +++ b/extensions/8.0/sqlite3 @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/8.0/uuid b/extensions/8.0/uuid index 2e96802e..7a522046 120000 --- a/extensions/8.0/uuid +++ b/extensions/8.0/uuid @@ -1 +1 @@ -../core/uuid/ \ No newline at end of file +../core/uuid \ No newline at end of file diff --git a/extensions/8.1/blackfire b/extensions/8.1/blackfire new file mode 120000 index 00000000..1179c0b9 --- /dev/null +++ b/extensions/8.1/blackfire @@ -0,0 +1 @@ +../core/blackfire \ No newline at end of file diff --git a/extensions/8.1/mysqli b/extensions/8.1/mysqli index f752c283..401b7fbf 120000 --- a/extensions/8.1/mysqli +++ b/extensions/8.1/mysqli @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/8.1/pdo_dblib b/extensions/8.1/pdo_dblib new file mode 120000 index 00000000..2261140c --- /dev/null +++ b/extensions/8.1/pdo_dblib @@ -0,0 +1 @@ +../core/pdo_dblib \ No newline at end of file diff --git a/extensions/8.1/pdo_mysql b/extensions/8.1/pdo_mysql index f752c283..401b7fbf 120000 --- a/extensions/8.1/pdo_mysql +++ b/extensions/8.1/pdo_mysql @@ -1 +1 @@ -../core/mysqli \ No newline at end of file +../core/pdo_mysql \ No newline at end of file diff --git a/extensions/8.1/pdo_pgsql b/extensions/8.1/pdo_pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/8.1/pdo_pgsql +++ b/extensions/8.1/pdo_pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/8.1/pdo_sqlite b/extensions/8.1/pdo_sqlite index 45ffc754..84c26578 120000 --- a/extensions/8.1/pdo_sqlite +++ b/extensions/8.1/pdo_sqlite @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/8.1/pgsql b/extensions/8.1/pgsql index 29ac8e8b..3a0bda2d 120000 --- a/extensions/8.1/pgsql +++ b/extensions/8.1/pgsql @@ -1 +1 @@ -../core/pgsql \ No newline at end of file +../core/pdo_pgsql \ No newline at end of file diff --git a/extensions/8.1/sqlite3 b/extensions/8.1/sqlite3 index 45ffc754..84c26578 120000 --- a/extensions/8.1/sqlite3 +++ b/extensions/8.1/sqlite3 @@ -1 +1 @@ -../core/sqlite3 \ No newline at end of file +../core/pdo_sqlite \ No newline at end of file diff --git a/extensions/core/blackfire/install.sh b/extensions/core/blackfire/install.sh index 3e58833b..e0e17927 100755 --- a/extensions/core/blackfire/install.sh +++ b/extensions/core/blackfire/install.sh @@ -1,12 +1,9 @@ #!/usr/bin/env bash set -e -set -ex # Install Blackfire -version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") - -if [[ -z "${BLACKFIRE_VERSION}" ]]; then +if [[ "${BLACKFIRE_VERSION}" == "" ]]; then echo "Blackfire version is not set in the environment variables. Exiting!" exit 1 fi @@ -14,40 +11,43 @@ fi # Let's make it flexible: for those who want to be safe, the image will be built with v1 # Now if you build the image yourself, you can build it with v2, this way everyone gets happy :) -mkdir /tmp/blackfire - -# Todo: Maybe version the Blackfire version by environment variable? :) - -if [ $BLACKFIRE_VERSION == "1" ]; then - echo "Installing Blackfire version 1" - # curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v2/releases/probe/php/linux/amd64/$version - curl -o /tmp/blackfire/blackfire.so "https://packages.blackfire.io/binaries/blackfire-php/1.78.0/blackfire-php-$CONTAINER_OS"_"$CONTAINER_ARCH-php-$version.so" - mv /tmp/blackfire/blackfire.so $(php -r "echo ini_get('extension_dir');")/blackfire.so - echo "extension=blackfire.so" > /etc/php/${PHP_VERSION}/mods-available/blackfire.ini - - # Adding this in the list of Ubuntu extensions because we use that list as a base for the modules list. - # TODO: question: cannot we use /etc/php/mods-available instead??? - touch /var/lib/php/modules/${PHP_VERSION}/registry/blackfire - # curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux_static/amd64 | tar zxp -C /tmp/blackfire - curl -o /tmp/blackfire/blackfire "https://packages.blackfire.io/binaries/blackfire-agent/1.50.0/blackfire-cli-$CONTAINER_OS"_"$CONTAINER_ARCH" - chmod +x /tmp/blackfire/blackfire - mv /tmp/blackfire/blackfire /usr/bin/blackfire - rm -Rf /tmp/blackfire - -elif [ $BLACKFIRE_VERSION == "2" ]; then - echo "Installing Blackfire version 2..." - - curl -o /tmp/blackfire/blackfire.so "https://packages.blackfire.io/binaries/blackfire-php/1.78.0/blackfire-php-$CONTAINER_OS"_"$CONTAINER_ARCH-php-$version.so" - mv /tmp/blackfire/blackfire.so $(php -r "echo ini_get('extension_dir');")/blackfire.so - echo "extension=blackfire.so" > /etc/php/${PHP_VERSION}/mods-available/blackfire.ini - touch /var/lib/php/modules/${PHP_VERSION}/registry/blackfire - curl -o /tmp/blackfire-cli.tar.gz "https://packages.blackfire.io/binaries/blackfire/2.10.0/blackfire-"$CONTAINER_OS"_"$CONTAINER_ARCH".tar.gz" - tar zxpf /tmp/blackfire-cli.tar.gz -C /tmp/blackfire - mv /tmp/blackfire/blackfire /usr/bin/blackfire - - rm -Rf /tmp/blackfire +version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") +# Probe is the same for v1 and v2 +curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/${TARGETOS}/${TARGETARCH}/$version +mkdir -p /tmp/blackfire +tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire +mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so +printf "extension=blackfire.so" > "/etc/php/${PHP_VERSION}/mods-available/blackfire.ini" +rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz + +if [[ "${BLACKFIRE_VERSION}" == "1" ]]; then + # Cli for v1 require specific version + curl -A "Docker" "https://packages.blackfire.io/binaries/blackfire-agent/1.50.0/blackfire-cli-${TARGETOS}"_"${TARGETARCH}" -o /tmp/blackfire + chmod +x /tmp/blackfire + mv /tmp/blackfire /usr/bin/blackfire + rm -Rf /tmp/blackfire +elif [[ "${BLACKFIRE_VERSION}" == "2" ]]; then + # Cli for v2 is latest version + echo "Installing Blackfire version 2..." + mkdir -p /tmp/blackfire + curl -A "Docker" -L https://blackfire.io/api/v1/releases/cli/linux/${TARGETARCH} | tar zxp -C /tmp/blackfire + if ! /tmp/blackfire/blackfire self:version --no-ansi | grep -qE "version 2\.[0-9]+\.[0-9]+"; then + echo "Blackfire installed is not version 2 : $(/tmp/blackfire/blackfire self:version --no-ansi)" + exit 1 + fi + mv /tmp/blackfire/blackfire /usr/bin/blackfire + rm -Rf /tmp/blackfire else - echo "Blackfire version in environment variable is either empty or the value is invalid" - echo "Value: '$BLACKFIRE_VERSION'" + echo "Blackfire version in environment variable is invalid" + echo "Value: '${BLACKFIRE_VERSION}'" exit 1 -fi \ No newline at end of file +fi + +# Let's perform a test +phpenmod -v $PHP_VERSION blackfire +/usr/bin/real_php -m | grep "blackfire" +# Check that there is no output on STDERR when starting php: +OUTPUT=`/usr/bin/real_php -r "echo '';" 2>&1` +[[ "$OUTPUT" == "" ]] +# And now, let's disable it! +phpdismod -v $PHP_VERSION blackfire \ No newline at end of file diff --git a/extensions/core/ev/install.sh b/extensions/core/ev/install.sh index 88910c5a..89368dac 100755 --- a/extensions/core/ev/install.sh +++ b/extensions/core/ev/install.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -e +if [[ "${TARGETARCH}" == "arm64" ]]; then + # 188 seconds to execute onto arm64 arch + >&2 echo "php-ev is not included with arm64 version (because build time is too long)" + exit 0; +fi export PECL_EXTENSION=ev ../docker-install.sh diff --git a/extensions/core/grpc/install.sh b/extensions/core/grpc/install.sh index 1687e5a4..896db7f2 100755 --- a/extensions/core/grpc/install.sh +++ b/extensions/core/grpc/install.sh @@ -1,9 +1,19 @@ #!/usr/bin/env bash set -e -export USE_PECL=1 -export DEV_DEPENDENCIES=zlib1g-dev - -export PECL_EXTENSION=grpc +export EXTENSION=grpc ../docker-install.sh + +#if [[ "${TARGETARCH}" == "arm64" ]]; then +# # Need few hours to compile onto arm64 arch +# >&2 echo "php-grpc is not included with arm64 version (because build time is too long)" +# exit 0; +#fi +#set -e +#export USE_PECL=1 +#export DEV_DEPENDENCIES=zlib1g-dev +# +#export PECL_EXTENSION=grpc +# +#../docker-install.sh diff --git a/extensions/core/install_all.sh b/extensions/core/install_all.sh index 68dffd7d..32157e0a 100755 --- a/extensions/core/install_all.sh +++ b/extensions/core/install_all.sh @@ -8,11 +8,17 @@ mv /etc/apt/apt.conf.d/docker-clean /tmp/docker-clean apt-get update +mkdir -p /var/log/ext-php/ + for ext in */; do \ cd $ext ext_no_slash=${ext%/} echo "***************** Installing $ext_no_slash ******************" - ./install.sh + LOG="/var/log/ext-php/install-${ext_no_slash}" + start=$(date +%s) + ./install.sh 2>&1 | tee -a "${LOG}.log" + end=$(date +%s) + echo "$(($end-$start)) seconds to execute ${ext_no_slash}" > "${LOG}.time" cd .. done diff --git a/extensions/core/mcrypt-7.1/install.sh b/extensions/core/mcrypt-7.1/install.sh deleted file mode 100755 index 6cad9edb..00000000 --- a/extensions/core/mcrypt-7.1/install.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -e -# Comments: MCrypt is deprecated and usage is generally discouraged. Provided here for legacy apps only. - -export EXTENSION=mcrypt -export DEV_DEPENDENCIES="libmcrypt-dev" -export DEPENDENCIES="libmcrypt4" - -../docker-install.sh diff --git a/extensions/core/mcrypt/install.sh b/extensions/core/mcrypt/install.sh index 015a9662..3ea333c5 100755 --- a/extensions/core/mcrypt/install.sh +++ b/extensions/core/mcrypt/install.sh @@ -3,10 +3,16 @@ set -e # Comments: MCrypt is deprecated and usage is generally discouraged. Provided here for legacy apps only. -export USE_PECL=1 -export PECL_EXTENSION=mcrypt-1.0.1 -export PHP_EXT_NAME=mcrypt # name of the extension (to put in PHP_EXTENSIONS variable) -export DEV_DEPENDENCIES="libmcrypt-dev" -export DEPENDENCIES="libmcrypt4" +if false; then # legacy install + export USE_PECL=1 + export PECL_EXTENSION=mcrypt-1.0.1 + export PHP_EXT_NAME=mcrypt # name of the extension (to put in PHP_EXTENSIONS variable) + export DEV_DEPENDENCIES="libmcrypt-dev" + export DEPENDENCIES="libmcrypt4" +else # Regular install + export EXTENSION=mcrypt + export DEV_DEPENDENCIES="libmcrypt-dev" + export DEPENDENCIES="libmcrypt4" +fi ../docker-install.sh diff --git a/extensions/core/pcov/install.sh b/extensions/core/pcov/install.sh index 4f172cae..8f681d39 100755 --- a/extensions/core/pcov/install.sh +++ b/extensions/core/pcov/install.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e -export PECL_EXTENSION=pcov +export EXTENSION=pcov +#export PECL_EXTENSION=pcov ../docker-install.sh diff --git a/extensions/core/mysqli/install.sh b/extensions/core/pdo_mysql/install.sh similarity index 100% rename from extensions/core/mysqli/install.sh rename to extensions/core/pdo_mysql/install.sh diff --git a/extensions/core/pgsql/install.sh b/extensions/core/pdo_pgsql/install.sh similarity index 100% rename from extensions/core/pgsql/install.sh rename to extensions/core/pdo_pgsql/install.sh diff --git a/extensions/core/sqlite3/install.sh b/extensions/core/pdo_sqlite/install.sh similarity index 100% rename from extensions/core/sqlite3/install.sh rename to extensions/core/pdo_sqlite/install.sh diff --git a/extensions/core/rdkafka/install.sh b/extensions/core/rdkafka/install.sh index 4a26d0c6..b4320828 100755 --- a/extensions/core/rdkafka/install.sh +++ b/extensions/core/rdkafka/install.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -e +if [[ "${TARGETARCH}" == "arm64" ]]; then + # 176 seconds to execute onto arm64 arch + >&2 echo "php-rdkafka is not included with arm64 version (because build time is too long)" + exit 0; +fi export DEV_DEPENDENCIES="librdkafka-dev" export DEPENDENCIES="librdkafka1" PECL_EXTENSION=rdkafka ../docker-install.sh diff --git a/extensions/core/snmp/install.sh b/extensions/core/snmp/install.sh index d3e18aef..7ed4967e 100755 --- a/extensions/core/snmp/install.sh +++ b/extensions/core/snmp/install.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -e +if [[ "${TARGETARCH}" == "arm64" ]]; then + # 109 seconds to execute onto arm64 arch + >&2 echo "php-snmp is not included with arm64 version (because build time is too long)" + exit 0; +fi export EXTENSION=snmp #export DEV_DEPENDENCIES="libsnmp-dev libssl-dev" #export DEPENDENCIES="snmp libsnmp30 libc6 libpci3 libsensors4 libwrap0 procps libssl1.1" diff --git a/extensions/core/swoole/install.sh b/extensions/core/swoole/install.sh index 301bd059..9f7057bc 100755 --- a/extensions/core/swoole/install.sh +++ b/extensions/core/swoole/install.sh @@ -1,7 +1,21 @@ #!/usr/bin/env bash + set -e -export DEV_DEPENDENCIES="zlib1g-dev" -export DEPENDENCIES="zlib1g" -export USE_PECL=1 -PECL_EXTENSION=swoole ../docker-install.sh +if [[ "${PHP_VERSION}" ~= "^7" ]]; then + if [[ "${TARGETARCH}" == "arm64" ]]; then + # It's too long to compile onto arm64 arch + >&2 echo "php-swoole is not included with arm64 version (because build time is too long)" + exit 0; + fi + ## http://pecl.php.net/package/swoole + export DEPENDENCIES="zlib1g" + export DEV_DEPENDENCIES="zlib1g-dev" + export USE_PECL=1 + export PECL_EXTENSION=swoole-4.8.11 + export PHP_EXT_NAME=swoole +else + export EXTENSION=swoole +fi + +../docker-install.sh diff --git a/orbit.yml b/orbit.yml index d55d70f8..e299420e 100644 --- a/orbit.yml +++ b/orbit.yml @@ -23,22 +23,13 @@ tasks: - orbit generate -f utils/Dockerfile.slim.blueprint -o Dockerfile.slim.cli -p "variant,cli" - orbit generate -f utils/Dockerfile.slim.blueprint -o Dockerfile.slim.fpm -p "variant,fpm" - orbit generate -f utils/Dockerfile.blueprint -o Dockerfile.apache -p "variant,apache;node_version," - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.apache.node10 -p "variant,apache;node_version,10" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.apache.node12 -p "variant,apache;node_version,12" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.apache.node14 -p "variant,apache;node_version,14" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.apache.node16 -p "variant,apache;node_version,16" + - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.apache.node -p "variant,apache" - orbit generate -f utils/Dockerfile.blueprint -o Dockerfile.cli -p "variant,cli;node_version," - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.cli.node10 -p "variant,cli;node_version,10" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.cli.node12 -p "variant,cli;node_version,12" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.cli.node14 -p "variant,cli;node_version,14" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.cli.node16 -p "variant,cli;node_version,16" + - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.cli.node -p "variant,cli" - orbit generate -f utils/Dockerfile.blueprint -o Dockerfile.fpm -p "variant,fpm;node_version," - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.fpm.node10 -p "variant,fpm;node_version,10" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.fpm.node12 -p "variant,fpm;node_version,12" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.fpm.node14 -p "variant,fpm;node_version,14" - - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.fpm.node16 -p "variant,fpm;node_version,16" + - orbit generate -f utils/Dockerfile.node.blueprint -o Dockerfile.fpm.node -p "variant,fpm" - |- - sed -i '1i\# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint)' Dockerfile.* + sed -i '2i\# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.*.blueprint)' Dockerfile.* - orbit generate -f utils/README.blueprint.md -o README.md - |- sed -i '1i\[DO NOT EDIT THIS FILE]: <> (Make yours changes in /utils/README.blueprint.md)' README.md diff --git a/test-image.sh b/test-image.sh deleted file mode 100755 index 18f73328..00000000 --- a/test-image.sh +++ /dev/null @@ -1,225 +0,0 @@ -#!/usr/bin/env bash - -set -eE -o functrace - -failure() { - local lineno=$1 - local msg=$2 - echo "Failed at $lineno: $msg" -} -trap 'failure ${LINENO} "$BASH_COMMAND"' ERR - -# Use either docker's 'build' command or 'buildx ' -export BUILDTOOL="buildx build --load --platform=${PLATFORM:-$(uname -p)}" - -# Let's replace the "." by a "-" with some bash magic -export BRANCH_VARIANT="${VARIANT//./-}" - -# Build with BuildKit https://docs.docker.com/develop/develop-images/build_enhancements/ -export DOCKER_BUILDKIT=1 # Force use of BuildKit -export BUILDKIT_STEP_LOG_MAX_SIZE=10485760 # output log limit fixed to 10MiB - -# Let's build the "slim" image. -docker $BUILDTOOL -t "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg GLOBAL_VERSION="${BRANCH}" --build-arg BLACKFIRE_VERSION="${BLACKFIRE_VERSION}" -f "Dockerfile.slim.${VARIANT}" . - -# Let's check that the extensions can be built using the "ONBUILD" statement -docker $BUILDTOOL -t test/slim_onbuild --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg BRANCH="$BRANCH" --build-arg BRANCH_VARIANT="$BRANCH_VARIANT" tests/slim_onbuild -# This should run ok (the sudo disable environment variables but call to composer proxy does not trigger PHP ini file regeneration) -docker run --rm test/slim_onbuild php -m | grep sockets -docker run --rm test/slim_onbuild php -m | grep pdo_pgsql -docker run --rm test/slim_onbuild php -m | grep pdo_sqlite -docker rmi test/slim_onbuild - -# Let's check that the extensions are available for composer using "ARG PHP_EXTENSIONS" statement: -docker $BUILDTOOL -t test/slim_onbuild_composer --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg BRANCH="$BRANCH" --build-arg BRANCH_VARIANT="$BRANCH_VARIANT" tests/slim_onbuild_composer -docker rmi test/slim_onbuild_composer - -echo "Running post-build unit tests" -# Post build unit tests -if [[ $VARIANT == cli* ]]; then CONTAINER_CWD=/usr/src/app; else CONTAINER_CWD=/var/www/html; fi -# Default user is 1000 -RESULT="$(docker run --rm "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" id -ur)" -[[ "$RESULT" == "1000" ]] - -# If mounted, default user has the id of the mount directory -mkdir user1999 && docker run --rm -v "$(pwd)":/mnt busybox chown 1999:1999 /mnt/user1999 -ls -al user1999 -RESULT="$(docker run --rm -v "$(pwd)"/user1999:$CONTAINER_CWD "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" id -ur)" -[[ "$RESULT" == "1999" ]] - -# Also, the default user can write on stdout and stderr -docker run --rm -v "$(pwd)"/user1999:$CONTAINER_CWD "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" bash -c "echo TEST > /proc/self/fd/2" - -rm -rf user1999 - -# and it also works for users with existing IDs in the container -mkdir -p user33 -cp tests/apache/composer.json user33/ -docker run --rm -v "$(pwd)":/mnt busybox chown -R 33:33 /mnt/user33 -ls -al user33 -RESULT="$(docker run --rm -v "$(pwd)"/user33:$CONTAINER_CWD "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" id -ur)" -[[ "$RESULT" == "33" ]] -RESULT="$(docker run --rm -v "$(pwd)"/user33:$CONTAINER_CWD "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" composer update -vvv)" -docker run --rm -v "$(pwd)":/mnt busybox rm -rf /mnt/user33 - -#Let's check that mbstring is enabled by default (they are compiled in PHP) -docker run --rm "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m | grep mbstring -docker run --rm "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m | grep PDO -# SQLite is disabled -# docker run --rm "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m | grep pdo_sqlite - -if [[ $VARIANT == apache* ]]; then - # Test if environment variables are passed to PHP - DOCKER_CID="$(docker run --rm -e MYVAR=foo -p "81:80" -d -v "$(pwd)":/var/www/html "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}")" - # Let's wait for Apache to start - sleep 5 - - RESULT="$(curl http://localhost:81/tests/test.php)" - [[ "$RESULT" == "foo" ]] - docker stop "$DOCKER_CID" - - # Test Apache document root (relative) - DOCKER_CID="$(docker run --rm -e MYVAR=foo -p "81:80" -d -v "$(pwd)":/var/www/html -e APACHE_DOCUMENT_ROOT=tests "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}")" - # Let's wait for Apache to start - sleep 5 - RESULT="$(curl http://localhost:81/test.php)" - [[ "$RESULT" == "foo" ]] - docker stop "$DOCKER_CID" - - # Test Apache document root (absolute) - DOCKER_CID="$(docker run --rm -e MYVAR=foo -p "81:80" -d -v "$(pwd)":/var/www/foo -e APACHE_DOCUMENT_ROOT=/var/www/foo/tests "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}")" - # Let's wait for Apache to start - sleep 5 - RESULT="$(curl http://localhost:81/test.php)" - [[ "$RESULT" == "foo" ]] - docker stop "$DOCKER_CID" - - # Test Apache HtAccess - DOCKER_CID="$(docker run --rm -p "81:80" -d -v "$(pwd)"/tests/testHtAccess:/foo -e APACHE_DOCUMENT_ROOT=/foo "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}")" - # Let's wait for Apache to start - sleep 5 - RESULT="$(curl http://localhost:81/)" - [[ "$RESULT" == "foo" ]] - docker stop "$DOCKER_CID" - - # Test PHP_INI_... variables are correctly handled by apache - DOCKER_CID="$(docker run --rm -e MYVAR=foo -p "81:80" -d -v "$(pwd)":/var/www/html -e PHP_INI_MEMORY_LIMIT=2G "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}")" - # Let's wait for Apache to start - sleep 5 - RESULT="$(curl http://localhost:81/tests/apache/echo_memory_limit.php)" - [[ "$RESULT" == "2G" ]] - docker stop "$DOCKER_CID" -fi - -if [[ $VARIANT == fpm* ]]; then - # Test if environment starts without errors - DOCKER_CID="$(docker run --rm -p "9000:9000" -d -v "$(pwd)":/var/www/html "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}")" - - # Let's wait for FPM to start - sleep 5 - - # If the container is still up, it will not fail when stopping. - docker stop "$DOCKER_CID" -fi - -# Let's check that the access to cron will fail with a message -set +e -RESULT="$(docker run --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="(>&1 echo 'foobar')" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -o 'Cron is not available in this image')" -set -e -[[ "$RESULT" == "Cron is not available in this image" ]] - -# Let's check that the configuration is loaded from the correct php.ini (development, production or imported in the image) -RESULT="$(docker run --rm "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" -[[ "$RESULT" == "error_reporting => 32767 => 32767" ]] - -RESULT="$(docker run --rm -e TEMPLATE_PHP_INI=production "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" -[[ "$RESULT" == "error_reporting => 22527 => 22527" ]] - -RESULT="$(docker run --rm -v "$(pwd)/tests/php.ini:/etc/php/${PHP_VERSION}/cli/php.ini" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" -[[ "$RESULT" == "error_reporting => 24575 => 24575" ]] - -RESULT="$(docker run --rm -e PHP_INI_ERROR_REPORTING="E_ERROR | E_WARNING" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" -[[ "$RESULT" == "error_reporting => 3 => 3" ]] - -# Tests that environment variables with an equal sign are correctly handled -RESULT="$(docker run --rm -e PHP_INI_SESSION__SAVE_PATH="tcp://localhost?auth=yourverycomplex\"passwordhere" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep "session.save_path")" -[[ "$RESULT" == "session.save_path => tcp://localhost?auth=yourverycomplex\"passwordhere => tcp://localhost?auth=yourverycomplex\"passwordhere" ]] - -# Tests that the SMTP parameter is set in uppercase -RESULT="$(docker run --rm -e PHP_INI_SMTP="192.168.0.1" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep "^SMTP")" -[[ "$RESULT" == "SMTP => 192.168.0.1 => 192.168.0.1" ]] - -# Tests that environment variables are passed to startup scripts when UID is set -RESULT="$(docker run --rm -e FOO="bar" -e STARTUP_COMMAND_1="env" -e UID=0 "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" sleep 1 | grep "FOO")" -[[ "$RESULT" == "FOO=bar" ]] - -# Tests that multi-commands are correctly executed when UID is set -RESULT="$(docker run --rm -e STARTUP_COMMAND_1="cd / && whoami" -e UID=0 "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" sleep 1)" -[[ "$RESULT" == "root" ]] - -# Tests that startup.sh is correctly executed -docker run --rm -v "$(pwd)"/tests/startup.sh:/etc/container/startup.sh "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m | grep "startup.sh executed" - -# Tests that disable_functions is commented in php.ini cli -RESULT="$(docker run --rm "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep "disable_functions")" -[[ "$RESULT" == "disable_functions => no value => no value" ]] - -################################# -# Let's build the "fat" image -################################# -docker $BUILDTOOL -t "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg GLOBAL_VERSION="${BRANCH}" -f "Dockerfile.${VARIANT}" . - -# Let's check that the crons are actually sending logs in the right place -RESULT="$(docker run --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="(>&1 echo 'foobar')" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=foobar' | head -n1)" -[[ "$RESULT" == "msg=foobar" ]] - -RESULT="$(docker run --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="(>&2 echo 'error')" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=error' | head -n1)" -[[ "$RESULT" == "msg=error" ]] - -# Let's check that the cron with a user different from root is actually run. -RESULT="$(docker run --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="whoami" -e CRON_USER_1="docker" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=docker' | head -n1)" -[[ "$RESULT" == "msg=docker" ]] - -# Let's check that 2 commands split with a ; are run by the same user. -RESULT="$(docker run --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="whoami;whoami" -e CRON_USER_1="docker" "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=docker' | wc -l)" -[[ "$RESULT" -gt "1" ]] - -# Let's check that mbstring cannot extension cannot be disabled -# Disabled because no more used in setup_extensions.php -#set +e -#docker run --rm -e PHP_EXTENSION_MBSTRING=0 thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT} php -i -#[[ "$?" = "1" ]] -#set -e - -# Let's check that the "xdebug.client_host" contains a value different from "no value" -docker run --rm -e PHP_EXTENSION_XDEBUG=1 "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -i | grep xdebug.client_host | grep -v "no value" - -# Let's check that "xdebug.mode" is set to "debug" by default -docker run --rm -e PHP_EXTENSION_XDEBUG=1 "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -i | grep xdebug.mode | grep "debug" - -# Let's check that "xdebug.mode" is properly overridden -docker run --rm -e PHP_EXTENSION_XDEBUG=1 -e PHP_INI_XDEBUG__MODE=debug,coverage "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -i | grep xdebug.mode | grep "debug,coverage" - -if [[ "${PHP_VERSION}" != "8.1" ]]; then - # Tests that blackfire + xdebug will output an error - RESULT="$(docker run --rm -e PHP_EXTENSION_XDEBUG=1 -e PHP_EXTENSION_BLACKFIRE=1 "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -v 2>&1 | grep 'WARNING: Both Blackfire and Xdebug are enabled. This is not recommended as the PHP engine may not behave as expected. You should strongly consider disabling Xdebug or Blackfire.')" - [[ "$RESULT" == "WARNING: Both Blackfire and Xdebug are enabled. This is not recommended as the PHP engine may not behave as expected. You should strongly consider disabling Xdebug or Blackfire." ]] - # Check that blackfire can be enabled - docker run --rm -e PHP_EXTENSION_BLACKFIRE=1 "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" php -m | grep blackfire -fi -# Let's check that the extensions are enabled when composer is run -docker $BUILDTOOL -t test/composer_with_gd --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg BRANCH="$BRANCH" --build-arg BRANCH_VARIANT="$BRANCH_VARIANT" tests/composer - -# This should run ok (the sudo disables environment variables but call to composer proxy does not trigger PHP ini file regeneration) -docker run --rm test/composer_with_gd sudo composer update -docker rmi test/composer_with_gd - -################################# -# Let's build the "node" images -################################# -docker $BUILDTOOL -t "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}-node10" --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg GLOBAL_VERSION="${BRANCH}" -f "Dockerfile.${VARIANT}.node10" . -docker $BUILDTOOL -t "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}-node12" --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg GLOBAL_VERSION="${BRANCH}" -f "Dockerfile.${VARIANT}.node12" . -docker $BUILDTOOL -t "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}-node14" --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg GLOBAL_VERSION="${BRANCH}" -f "Dockerfile.${VARIANT}.node14" . -docker $BUILDTOOL -t "thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}-node16" --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg GLOBAL_VERSION="${BRANCH}" -f "Dockerfile.${VARIANT}.node16" . - -echo "Tests passed with success" diff --git a/tests-suite/README.md b/tests-suite/README.md new file mode 100644 index 00000000..46aa9f81 --- /dev/null +++ b/tests-suite/README.md @@ -0,0 +1,25 @@ +# Test suite + +These tests use bash_unit to allow a clean visualisation of tests. +This file describe some features used here. + +## `./config` file + +This file allow the test suite to have some variables / command already set. You can customize. + +## Setup/teardown + +Like any regular test unit process, you can play command at initialisation of the test, and other at this end. It's used to generate fake directories or start docker commands. The teardown allow to clean directory/started container but if any fatal error happens (or `ctrl+c`), the tear down if not played. So you can have unwanted container started (you need to clean them manually, but it's not require to clean to re-execute because port/name/directory are random and uniq for each test suite). + +## Pipe to `/dev/null` + +Lot of command display result, error, warning. All are forward to /dev/null when it's not relevant (only the exit code is used `$?`). It's maybe usefull to provide a full log on these cases if it's possible to find a solution for that. + +## Uncommon command `tail -n +1` + +When there is comparaison with grep, it's required to prefix by ` | tail -n +1`. It's do nothing at all (only display from the first line to the end) but avoid this warning "write /dev/stdout: broken pipe" if command make too long time for response (required for arm64 testing). + +## `[[ $VARIANT != apache* ]]` + +Some part of the test is not depend on variant of image. Per example here, apache. It's maybe useful to find another way to just ignore the test instead of `exit 0` the full file (bash unit do not manage that currently). + diff --git a/tests/apache/echo_memory_limit.php b/tests-suite/assets/apache/echo_memory_limit.php similarity index 100% rename from tests/apache/echo_memory_limit.php rename to tests-suite/assets/apache/echo_memory_limit.php diff --git a/tests/testHtAccess/.htaccess b/tests-suite/assets/apache/htaccess/.htaccess similarity index 100% rename from tests/testHtAccess/.htaccess rename to tests-suite/assets/apache/htaccess/.htaccess diff --git a/tests/testHtAccess/test.php b/tests-suite/assets/apache/htaccess/test.php similarity index 100% rename from tests/testHtAccess/test.php rename to tests-suite/assets/apache/htaccess/test.php diff --git a/tests/test.php b/tests-suite/assets/apache/index.php similarity index 100% rename from tests/test.php rename to tests-suite/assets/apache/index.php diff --git a/tests/composer/Dockerfile b/tests-suite/assets/composer/Dockerfile similarity index 65% rename from tests/composer/Dockerfile rename to tests-suite/assets/composer/Dockerfile index 6675e180..e33e0a18 100644 --- a/tests/composer/Dockerfile +++ b/tests-suite/assets/composer/Dockerfile @@ -1,8 +1,10 @@ ARG BRANCH ARG BRANCH_VARIANT ARG PHP_VERSION +ARG REPO +ARG TAG_PREFIX -FROM thecodingmachine/php:${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT} +FROM ${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT} ENV PHP_EXTENSION_GD=1 diff --git a/tests/composer/composer.json b/tests-suite/assets/composer/composer.json similarity index 100% rename from tests/composer/composer.json rename to tests-suite/assets/composer/composer.json diff --git a/tests/php.ini b/tests-suite/assets/php-ini/php.ini similarity index 100% rename from tests/php.ini rename to tests-suite/assets/php-ini/php.ini diff --git a/tests/startup.sh b/tests-suite/assets/startup.sh similarity index 100% rename from tests/startup.sh rename to tests-suite/assets/startup.sh diff --git a/tests-suite/bash_unit b/tests-suite/bash_unit new file mode 100755 index 00000000..b465dbf4 --- /dev/null +++ b/tests-suite/bash_unit @@ -0,0 +1,469 @@ +#!/usr/bin/env bash +# +# bash unit testing enterprise edition framework for professionals +# Copyright (C) 2011-2016 Pascal Grange +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# https://github.com/pgrange/bash_unit + +VERSION=v2.0.0 + +ESCAPE=$(printf "\033") +NOCOLOR="${ESCAPE}[0m" +RED="${ESCAPE}[91m" +GREEN="${ESCAPE}[92m" +YELLOW="${ESCAPE}[93m" +BLUE="${ESCAPE}[94m" + +# Make bash_unit immune to some basic unix commands faking +CAT="$(which cat)" +SED="$(which sed)" +GREP="$(which grep)" +RM="$(which rm)" +SHUF="$(which shuf)" + +fail() { + local message=${1:-} + local stdout=${2:-} + local stderr=${3:-} + + notify_test_failed "$__bash_unit_current_test__" "$message" + [[ ! -z $stdout ]] && [ -s "$stdout" ] && notify_stdout < "$stdout" + [[ ! -z $stderr ]] && [ -s "$stderr" ] && notify_stderr < "$stderr" + + stacktrace | notify_stack + exit 1 +} + +assert() { + local assertion=$1 + local message=${2:-} + + _assert_expression \ + "$assertion" \ + "[ \$status == 0 ]" \ + "\"$message\"" +} + +assert_fails() { + local assertion=$1 + local message=${2:-} + + _assert_expression \ + "$assertion" \ + "[ \$status != 0 ]" \ + "\"$message\"" +} + +assert_fail() { + #deprecated, use assert_fails instead + assert_fails "$@" +} + +assert_status_code() { + local expected_status=$1 + local assertion="$2" + local message="${3:-}" + + _assert_expression \ + "$assertion" \ + "[ \$status == $expected_status ]" \ + "\"$message\" expected status code $expected_status but was \$status" +} + +_assert_expression() { + local assertion=$1 + local condition=$2 + local message=$3 + ( + local stdout=$(mktemp) + local stderr=$(mktemp) + trap "$RM -f \"$stdout\" \"$stderr\"" EXIT + + local status + eval "($assertion)" >"$stdout" 2>"$stderr" && status=$? || status=$? + if ! eval "$condition" + then + fail "$(eval echo $message)" "$stdout" "$stderr" + fi + ) || exit $? +} + +assert_equals() { + local expected=$1 + local actual=$2 + local message=${3:-} + [[ -z $message ]] || message="$message\n" + + if [ "$expected" != "$actual" ] + then + fail "$message expected [$expected] but was [$actual]" + fi +} + +assert_not_equals() { + local unexpected=$1 + local actual=$2 + local message=${3:-} + [[ -z $message ]] || message="$message\n" + + [ "$unexpected" != "$actual" ] || \ + fail "$message expected different value than [$unexpected] but was the same" +} + +assert_matches() { + local expected=$1 + local actual=$2 + local message=${3:-} + [[ -z $message ]] || message="$message\n" + + if [[ ! "${actual}" =~ ${expected} ]]; then + fail "$message expected regex [$expected] to match [$actual]" + fi +} + +assert_not_matches() { + local unexpected=$1 + local actual=$2 + local message=${3:-} + [[ -z $message ]] || message="$message\n" + + if [[ "${actual}" =~ ${unexpected} ]]; then + fail "$message expected regex [$unexpected] should not match but matched [$actual]" + fi +} + +assert_no_diff() { + local expected=$1 + local actual=$2 + local message=${3:-} + [[ -z $message ]] || message="$message\n" + + diff -u "${expected}" "${actual}" >/dev/null || \ + fail "$message expected '${actual}' to be identical to '${expected}' but was different" +} + +fake() { + local command=$1 + shift + if [ $# -gt 0 ] + then + eval "function $command() { export FAKE_PARAMS=(\"\$@\") ; $@ ; }" + else + eval "function $command() { echo \"$($CAT)\" ; }" + fi + export -f $command +} + +stacktrace() { + local i=1 + while ! [ -z "${BASH_SOURCE[$i]:-}" ] + do + echo ${BASH_SOURCE[$i]}:${BASH_LINENO[$((i-1))]}:${FUNCNAME[$i]}\(\) + i=$((i + 1)) + done | "$GREP" -v "^$BASH_SOURCE" +} + +run_test_suite() { + local failure=0 + + if run_setup_suite + then + run_tests || failure=$? + else + failure=$? + fi + run_teardown_suite + + return $failure +} + +run_setup_suite() { + if declare -F | "$GREP" ' setup_suite$' >/dev/null + then + setup_suite + fi +} + +maybe_shuffle() { + ((randomise)) && $SHUF || $CAT +} + +run_tests() { + local failure=0 + + for pending_test in $(set | "$GREP" -E '^(pending|todo).* \(\)' | "$GREP" -E "$test_pattern" | "$SED" -e 's: .*::') + do + notify_test_starting "$pending_test" + notify_test_pending "$pending_test" + done + + + for test in $(set | "$GREP" -E '^test.* \(\)' | "$GREP" -E "$test_pattern" | "$SED" -e 's: .*::' | maybe_shuffle) + do + ( + local status=0 + declare -F | "$GREP" ' setup$' >/dev/null && setup + (__bash_unit_current_test__="$test" run_test) || status=$? + declare -F | "$GREP" ' teardown$' >/dev/null && teardown + exit $status + ) + failure=$(( $? || failure)) + done + return $failure +} + +run_test() { + set -e + notify_test_starting "$__bash_unit_current_test__" + "$__bash_unit_current_test__" && notify_test_succeeded "$__bash_unit_current_test__" +} + +run_teardown_suite() { + if declare -F | "$GREP" ' teardown_suite$' >/dev/null + then + teardown_suite + fi +} + +usage() { + echo "$1" >&2 + echo "$0 [-f ] [-p ] [-p ] [-r] ... ..." >&2 + echo >&2 + echo "Runs tests in test files that match s" >&2 + echo " is optional only supported value is tap" >&2 + echo "-r to execute test cases in random order" >&2 + echo "-v to get current version information" >&2 + echo "See https://github.com/pgrange/bash_unit" >&2 + exit 1 +} + +# Formating + +pretty_success() { + pretty_format "$GREEN" "\u2713" "${1:-}" +} + +pretty_warning() { + pretty_format "$YELLOW" "\u2717" "$1" +} + +pretty_failure() { + pretty_format "$RED" "\u2717" "${1:-}" +} + +pretty_format() { + local color="$1" + local pretty_symbol="$2" + local alt_symbol="${3:-}" + local term_utf8=false +#env + if is_terminal && [[ "${LANG:-}" =~ .*UTF-8.* ]] + then + term_utf8=true + fi + ( + $CAT + if $term_utf8 + then + echo -en " $pretty_symbol " + else + [[ ! -z "$alt_symbol" ]] && echo -en " $alt_symbol " + fi + ) | color "$color" +} + +color() { + _start_color() { + if is_terminal ; then echo -en "$color" ; fi + } + _stop_color() { + if is_terminal ; then echo -en "$NOCOLOR" ; fi + } + local color=$1 + shift + _start_color + if [ $# -gt 0 ] + then + echo $* + else + $CAT + fi + _stop_color +} + +is_terminal() { + [ -t 1 ] || [[ "${FORCE_COLOR:-}" == true ]] +} + +text_format() { + notify_suite_starting() { + local test_file="$1" + echo "Running tests in $test_file" + } + notify_test_starting() { + local test="$1" + echo -e -n "\tRunning $test ... " | color "$BLUE" + } + notify_test_pending() { + echo -n "PENDING" | pretty_warning + echo + } + + notify_test_succeeded() { + echo -n "SUCCESS" | pretty_success + echo + } + notify_test_failed() { + local message="$2" + echo -n "FAILURE" | pretty_failure + echo + [[ -z $message ]] || printf -- "$message\n" + } + notify_stdout() { + "$SED" 's:^:out> :' | color "$GREEN" + } + notify_stderr() { + "$SED" 's:^:err> :' | color "$RED" + } + notify_stack() { + color "$YELLOW" + } + notify_suites_succeded() { + echo -n "Overall result: SUCCESS" | pretty_success + echo + } + notify_suites_failed() { + echo -n "Overall result: FAILURE" | pretty_failure + echo + } +} + +tap_format() { + notify_suite_starting() { + local test_file="$1" + echo "# Running tests in $test_file" + } + notify_test_starting() { + : + } + notify_test_pending() { + local test="$1" + echo -n "ok" | pretty_warning - + echo -n "$test" | color "$BLUE" + echo " # skip test to be written" | color "$YELLOW" + } + notify_test_succeeded() { + local test="$1" + echo -n "ok" | pretty_success - + echo "$test" | color "$BLUE" + } + notify_test_failed() { + local test="$1" + local message="$2" + echo -n "not ok" | pretty_failure - + echo "$test" | color "$BLUE" + [[ -z $message ]] || printf -- "$message\n" | "$SED" -u -e 's/^/# /' + } + notify_stdout() { + "$SED" 's:^:# out> :' | color "$GREEN" + } + notify_stderr() { + "$SED" 's:^:# err> :' | color "$RED" + } + notify_stack() { + "$SED" 's:^:# :' | color "$YELLOW" + } + notify_suites_succeded() { + : + } + notify_suites_failed() { + : + } +} + +output_format=text +test_pattern="" +separator="" +randomise=0 +while getopts "vp:f:r" option +do + case "$option" in + p) + test_pattern="${test_pattern}${separator}${OPTARG}" + separator="|" + ;; + f) + output_format="${OPTARG}" + ;; + r) + randomise=1 + ;; + v) + echo "bash_unit $VERSION" + exit + ;; + ?|:) + usage + ;; + esac +done +shift $((OPTIND-1)) + +for test_file in "$@" +do + test -e "$test_file" || usage "file does not exist: $test_file" + test -r "$test_file" || usage "can not read file: $test_file" +done + +case "$output_format" in + text) + text_format + ;; + tap) + tap_format + ;; + *) + usage "unsupported output format: $output_format" + ;; +esac + +#run tests received as parameters +failure=0 +for test_file in "$@" +do + notify_suite_starting "$test_file" + ( + set -e # Ensure bash_unit will exit with failure + # in case of syntax error. + if [[ "${STICK_TO_CWD}" != true ]] + then + cd "$(dirname "$test_file")" + source "$(basename "$test_file")" + else + source "$test_file" + fi + set +e + run_test_suite + ) + failure=$(( $? || failure)) +done + +if ((failure)) +then + notify_suites_failed +else + notify_suites_succeded +fi + +exit $failure diff --git a/tests-suite/config b/tests-suite/config new file mode 100755 index 00000000..b99db27a --- /dev/null +++ b/tests-suite/config @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +export PLATFORM="${PLATFORM:-$(uname -p)}" +export BUILDTOOL="build --platform=${PLATFORM}" +export RUN_OPTIONS="--platform=${PLATFORM}" +export PHP_VERSION=${PHP_VERSION:-8.1} +export BRANCH=${BRANCH:-v4} +export VARIANT=${VARIANT:-apache} +export BRANCH_VARIANT="${VARIANT//./-}" +export REPO="${REPO:-thecodingmachine/php}" +export TAG_PREFIX="${TAG_PREFIX:-}" +export SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +function unused_port() { + N=${1:-1} + comm -23 \ + <(seq "1025" "65535" | sort) \ + <(ss -Htan | + awk '{print $4}' | + cut -d':' -f2 | + sort -u) | + shuf | + head -n "$N" +} + +function waitfor() { + URL=${1} + TIMEOUT=${2:-60} + while ! curl -sq "${URL}" > /dev/null 2>&1; do + TIMEOUT=$((TIMEOUT-=1)) + if [[ "${TIMEOUT}" -lt "1" ]]; then + >&2 echo "Can not fetch ${URL}" + return 1 + fi + sleep 1 + done + return 0 +} \ No newline at end of file diff --git a/tests-suite/onbuild.sh b/tests-suite/onbuild.sh new file mode 100755 index 00000000..57f9af69 --- /dev/null +++ b/tests-suite/onbuild.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +. ./config + +############################################################ +## Let's check that the extensions can be built +## using the "ONBUILD" statement +############################################################ +test_onbluidBase() { + assert 'onbluidBase' "Image build failed" + # This should run ok (the sudo disable environment variables but call to composer proxy does not trigger PHP ini file regeneration) + assert 'onbluidBaseExtensionIsPresent sockets' "Extension sockets not found" + assert 'onbluidBaseExtensionIsPresent pdo_pgsql' "Extension pdo_pgsql not found" + assert 'onbluidBaseExtensionIsPresent pdo_sqlite' "Extension pdo_sqlite not found" +} +onbluidBase() { + docker ${BUILDTOOL} -t ${DOCKER1_NAME} - < "${TMP_DIR}/composer.json" + { + "require": { + "ext-gd": "*" + } + } +EOF + cat < "${TMP_DIR}/Dockerfile" + ARG PHP_EXTENSIONS="gd" + FROM ${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT} + + COPY composer.json composer.json + + # Let's check that GD is available. + RUN composer install +EOF + docker ${BUILDTOOL} -t ${DOCKER2_NAME} "${TMP_DIR}" + return $? +} + +setup_suite() { + export TMP_DIR="$(mktemp -d)" + export DOCKER1_NAME="test/slim_onbuild_$(unused_port)" + export DOCKER2_NAME="test/slim_onbuild_composer_$(unused_port)" +} + +teardown_suite() { + docker rmi --force "${DOCKER1_NAME}" > /dev/null + docker rmi --force "${DOCKER2_NAME}" > /dev/null + if [[ "" != ${TMP_DIR} ]]; then docker run ${RUN_OPTIONS} --rm -v "/tmp":/tmp busybox rm -rf "${TMP_DIR}" > /dev/null 2>&1; fi +} diff --git a/tests-suite/php-blackfire.sh b/tests-suite/php-blackfire.sh new file mode 100755 index 00000000..7c73fcb4 --- /dev/null +++ b/tests-suite/php-blackfire.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +. ./config + +#if [[ "${PHP_VERSION}" == "8.1" ]]; then +# echo "-- PHP8.1 not support yet blackfire" +# return 0 +#fi +test_enable() { + # Check that blackfire can be enabled + docker run ${RUN_OPTIONS} --rm -e PHP_EXTENSION_BLACKFIRE=1 "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" \ + php -m | tail -n +1 | grep -q blackfire + assert_equals "0" "$?" +} +test_alertConflictWithXDebug() { + # Tests that blackfire + xdebug will output an error + RESULT="$(docker run ${RUN_OPTIONS} --rm -e PHP_EXTENSION_XDEBUG=1 -e PHP_EXTENSION_BLACKFIRE=1 \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" \ + php -v 2>&1 | tail -n +1 | grep 'WARNING: Both Blackfire and Xdebug are enabled. This is not recommended as the PHP engine may not behave as expected. You should strongly consider disabling Xdebug or Blackfire.')" + assert_equals "WARNING: Both Blackfire and Xdebug are enabled. This is not recommended as the PHP engine may not behave as expected. You should strongly consider disabling Xdebug or Blackfire." "$RESULT" +} + diff --git a/tests-suite/php-extensions.sh b/tests-suite/php-extensions.sh new file mode 100755 index 00000000..07edece7 --- /dev/null +++ b/tests-suite/php-extensions.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +. ./config + +########################################################### +# Let's check that mbstring is enabled by default +# (it's compiled in PHP) +########################################################### +test_presenceOfMbstring() { + RESULT=$(docker run ${RUN_OPTIONS} --rm "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m | tail -n +1 | grep --color=never mbstring) + assert_equals "mbstring" "${RESULT}" "Missing php-mbstring" +} +############################################################ +## Let's check that mbstring is enabled by default +## (it's compiled in PHP) +############################################################ +test_presenceOfPDO() { + RESULT=$(docker run ${RUN_OPTIONS} --rm "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m | tail -n +1 | grep --color=never PDO) + assert_equals "PDO" "${RESULT}" "Missing php-PDO" +} +############################################################ +## Let's check that the extensions are enabled when composer is run +############################################################ +test_enableGdWithComposer() { + docker $BUILDTOOL -t test/composer_with_gd \ + --build-arg PHP_VERSION="${PHP_VERSION}" --build-arg BRANCH="$BRANCH" \ + --build-arg BRANCH_VARIANT="$BRANCH_VARIANT" --build-arg REPO="$REPO" --build-arg TAG_PREFIX="$TAG_PREFIX" \ + "${SCRIPT_DIR}/assets/composer" > /dev/null 2>&1 + assert_equals "0" "$?" "Docker build failed" + # This should run ok (the sudo disables environment variables but call to composer proxy does not trigger PHP ini file regeneration) + docker run ${RUN_OPTIONS} --rm test/composer_with_gd sudo composer update > /dev/null 2>&1 + assert_equals "0" "$?" "Docker run failed" +} + +teardown_suite() { + docker rmi test/composer_with_gd > /dev/null 2>&1 +} diff --git a/tests-suite/php-ini.sh b/tests-suite/php-ini.sh new file mode 100755 index 00000000..2a6cca6f --- /dev/null +++ b/tests-suite/php-ini.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +. ./config + +# Let's check that the configuration is loaded from the correct php.ini (development, production or imported in the image) +############################################################ +## Templates +############################################################ +test_templateDefaultErrorReporting() { + RESULT="$(docker run ${RUN_OPTIONS} --rm "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" + assert_equals "error_reporting => 32767 => 32767" "$RESULT" "Wrong default error reporting" +} +test_templateProductionErrorReporting() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e TEMPLATE_PHP_INI=production \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" + assert_equals "error_reporting => 22527 => 22527" "$RESULT" "Wrong production error reporting" +} +test_templateCustomErrorReporting() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -v "${SCRIPT_DIR}/assets/php-ini/php.ini:/etc/php/${PHP_VERSION}/cli/php.ini" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" + assert_equals "error_reporting => 24575 => 24575" "$RESULT" "Wrong custom php.ini error reporting" +} +############################################################ +## PHP_INI_* +############################################################ +test_environmentErrorReporting() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e PHP_INI_ERROR_REPORTING="E_ERROR | E_WARNING" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep error_reporting)" + [[ "$RESULT" == "error_reporting => 3 => 3" ]] + assert_equals "error_reporting => 3 => 3" "$RESULT" "Wrong Environment error reporting" +} +############################################################ +## PHP_INI_SESSION__SAVE_PATH +## Tests that environment variables with an equal sign are correctly handled +############################################################ +test_sessionSavePath() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e PHP_INI_SESSION__SAVE_PATH="tcp://localhost?auth=yourverycomplex\"passwordhere" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep "session.save_path")" + [[ "$RESULT" == "" ]] + assert_equals "session.save_path => tcp://localhost?auth=yourverycomplex\"passwordhere => tcp://localhost?auth=yourverycomplex\"passwordhere" "$RESULT" "Wrong Environment PHP_INI_SESSION__SAVE_PATH" +} +############################################################ +## PHP_INI_SMTP +## Tests that the SMTP parameter is set in uppercase +############################################################ +test_smtp() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e PHP_INI_SMTP="192.168.0.1" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep "^SMTP")" + assert_equals "SMTP => 192.168.0.1 => 192.168.0.1" "$RESULT" "Wrong Environment PHP_INI_SMTP" +} +############################################################ +## Tests that disable_functions is commented in php.ini cli +############################################################ +test_disabledFunctionsIsCommented() { + RESULT="$(docker run ${RUN_OPTIONS} --rm \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -i | grep "disable_functions")" + assert_equals "disable_functions => no value => no value" "$RESULT" +} + diff --git a/tests-suite/php-xdebug.sh b/tests-suite/php-xdebug.sh new file mode 100755 index 00000000..96ca5bc9 --- /dev/null +++ b/tests-suite/php-xdebug.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +. ./config + +############################################################ +## xdebug +############################################################ +test_config() { + # Let's check that the "xdebug.client_host" contains a value different from "no value" + docker run ${RUN_OPTIONS} --rm -e PHP_EXTENSION_XDEBUG=1 "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" \ + php -i | grep xdebug.client_host | grep -v -q "no value" + assert_equals "0" "$?" '"xdebug.client_host" contains "no value"' + + # Let's check that "xdebug.mode" is set to "debug" by default + docker run ${RUN_OPTIONS} --rm -e PHP_EXTENSION_XDEBUG=1 "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" \ + php -i | grep xdebug.mode | grep -q "debug" + assert_equals "0" "$?" '"xdebug.mode" is not set to "debug" by default' + + # Let's check that "xdebug.mode" is properly overridden + docker run ${RUN_OPTIONS} --rm -e PHP_EXTENSION_XDEBUG=1 -e PHP_INI_XDEBUG__MODE=debug,coverage \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" \ + php -i | grep xdebug.mode | grep -q "debug,coverage" + assert_equals "0" "$?" '"xdebug.mode" is not properly overridden' +} diff --git a/tests-suite/tool-startup-command.sh b/tests-suite/tool-startup-command.sh new file mode 100755 index 00000000..2ddabe68 --- /dev/null +++ b/tests-suite/tool-startup-command.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +. ./config + +############################################################ +## Tests that environment variables are passed to startup scripts when UID is set +############################################################ +test_uid() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e FOO="bar" -e STARTUP_COMMAND_1="env" -e UID=0 \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" sleep 1 | grep "FOO")" + assert_equals "FOO=bar" "$RESULT" +} +############################################################ +## Tests that multi-commands are correctly executed when UID is set +############################################################ +test_asRoot() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e STARTUP_COMMAND_1="cd / && whoami" -e UID=0 \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" sleep 1)" + assert_equals "root" "$RESULT" +} +############################################################ +## Tests that startup.sh is correctly executed +############################################################ +test_withFile() { + docker run ${RUN_OPTIONS} --rm -v "${SCRIPT_DIR}/assets/startup.sh":/etc/container/startup.sh \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" php -m 2>/dev/null | grep -q "startup.sh executed" + assert_equals "0" "$?" +} diff --git a/tests-suite/tool-supercronic.sh b/tests-suite/tool-supercronic.sh new file mode 100755 index 00000000..1deb2a07 --- /dev/null +++ b/tests-suite/tool-supercronic.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +. ./config + +############################################################ +## Let's check that the access to cron will fail with a message +############################################################ +test_displayErrorWhenMissing() { + RESULT=$(docker run ${RUN_OPTIONS} --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="(>&1 echo 'foobar')" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -o 'Cron is not available in this image') + assert_equals "Cron is not available in this image" "$RESULT" +} +############################################################ +## Let's check that the crons are actually sending logs in the right place +############################################################ +test_errorLog() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="(>&1 echo 'foobar')" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=foobar' | head -n1)" + assert_equals "msg=foobar" "$RESULT" "std1" + RESULT="$(docker run ${RUN_OPTIONS} --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="(>&2 echo 'error')" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=error' | head -n1)" + assert_equals "msg=error" "$RESULT" "std2" +} +############################################################ +## Let's check that the cron with a user different from root is actually run. +############################################################ +test_changeUser() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="whoami" -e CRON_USER_1="docker" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=docker' | head -n1)" + assert_equals "msg=docker" "$RESULT" +} +############################################################ +## Let's check that 2 commands split with a ; are run by the same user. +############################################################ +test_twoCommandInOneRow() { + RESULT="$(docker run ${RUN_OPTIONS} --rm -e CRON_SCHEDULE_1="* * * * * * *" -e CRON_COMMAND_1="whoami;whoami" -e CRON_USER_1="docker" \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-${BRANCH_VARIANT}" sleep 1 2>&1 | grep -oP 'msg=docker' | wc -l)" + assert '[ "$RESULT" -gt "1" ]' +} diff --git a/tests-suite/users-rights.sh b/tests-suite/users-rights.sh new file mode 100755 index 00000000..54acc92c --- /dev/null +++ b/tests-suite/users-rights.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +. ./config + +############################################################ +## Default user is 1000 +############################################################ +test_defaultUserUidIs1000() { + RESULT="$(docker run ${RUN_OPTIONS} --rm "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" \ + id -ur)" + assert_equals "0" "$?" "Docker run failed" + assert_equals "1000" "${RESULT}" "Default user UID missmatch" +} + +############################################################ +## If mounted, default user has the id +## of the mounted directory +############################################################ +test_defaultUserHasUidOfMountedDirectory() { + mkdir -p "${TMP_DIR}/user1999" + docker run ${RUN_OPTIONS} --rm -v /tmp:/tmp busybox chown 1999:1999 "${TMP_DIR}/user1999" > /dev/null 2>&1 + RESULT="$(docker run ${RUN_OPTIONS} --rm -v "${TMP_DIR}/user1999":"${CONTAINER_CWD}" "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" \ + id -ur)" + assert_equals "0" "$?" "Docker run failed" + assert_equals "1999" "${RESULT}" "Default user UID missmatch with mounted directory" +} + +############################################################ +## The default user can write on stdout and stderr +############################################################ +test_defaultUserCanWriteOnStdoutAndStderr() { + docker run ${RUN_OPTIONS} --rm -v "${TMP_DIR}/user1999":"${CONTAINER_CWD}" "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" \ + bash -c "echo TEST > /proc/self/fd/2" >> /dev/null + assert_equals "0" "$?" "Docker run failed" +} + +############################################################ +## It's also works for users with existing IDs in the container +############################################################ +test_defaultUserCanWriteOnStdoutAndStderr() { + mkdir -p "${TMP_DIR}/user33" + cat << EOF > "${TMP_DIR}/user33/composer.json" + { + "autoload": { + "psr-4": { + "\\\\": "." + } + } + } +EOF + docker run ${RUN_OPTIONS} --rm -v /tmp:/tmp busybox chown -R 33:33 "${TMP_DIR}/user33" > /dev/null 2>&1 + RESULT="$(docker run ${RUN_OPTIONS} --rm -v "${TMP_DIR}/user33":"${CONTAINER_CWD}" "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" \ + id -ur)" + assert_equals "0" "$?" "Docker run 1 failed" + assert_equals "33" "${RESULT}" "Default user UID missmatch" + docker run ${RUN_OPTIONS} --rm -v "${TMP_DIR}/user33":"${CONTAINER_CWD}" "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" \ + composer update -vvv > /dev/null 2>&1 + assert_equals "0" "$?" "Docker run 2 failed" +} + + +setup_suite() { + export TMP_DIR="$(mktemp -d)" + if [[ $VARIANT == cli* ]]; then export CONTAINER_CWD=/usr/src/app; else export CONTAINER_CWD=/var/www/html; fi +} + +teardown_suite() { + if [[ "" != ${TMP_DIR} ]]; then docker run ${RUN_OPTIONS} --rm -v "/tmp":/tmp busybox rm -rf "${TMP_DIR}" > /dev/null 2>&1; fi +} diff --git a/tests-suite/variant-apache.sh b/tests-suite/variant-apache.sh new file mode 100755 index 00000000..3c08ad09 --- /dev/null +++ b/tests-suite/variant-apache.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +. ./config + +if [[ $VARIANT != apache* ]]; then + echo "-- There is not an 'apache' variant" + return 0; +fi; +############################################################ +## Run apache and try to retrieve var content +############################################################ +test_displayVarInPhp() { + RESULT="$(curl -sq http://localhost:${DOCKER1_PORT}/apache/ 2>&1)" + assert_equals "foo" "$RESULT" "MYVAR was not populate onto php" +} +############################################################ +## Run apache with relative document root +############################################################ +test_documentRootRelative() { + RESULT="$(curl -sq http://localhost:${DOCKER2_PORT}/ 2>&1)" + assert_equals "foo" "$RESULT" "Apache document root (relative) does not work properly" +} +############################################################ +## Run apache with absolute document root +############################################################ +test_documentRootAbsolute() { + RESULT="$(curl -sq http://localhost:${DOCKER3_PORT}/ 2>&1)" + assert_equals "foo" "$RESULT" "Apache document root (absolute) does not work properly" +} +############################################################ +## Run apache HtAccess +############################################################ +test_htaccessRewrite() { + RESULT="$(curl -sq http://localhost:${DOCKER1_PORT}/apache/htaccess/ 2>&1)" + assert_equals "foo" "$RESULT" "Apache HtAccess RewriteRule was not applied" +} +############################################################ +## Test PHP_INI_... variables are correctly handled by apache +############################################################ +test_changeMemoryLimit() { + RESULT="$(curl -sq http://localhost:${DOCKER1_PORT}/apache/echo_memory_limit.php 2>&1 )" + assert_equals "2G" "$RESULT" "Apache PHP_INI_MEMORY_LIMIT was not applied" +} + +setup_suite() { + # SETUP apache1 + export DOCKER1_PORT="$(unused_port)" + export DOCKER1_NAME="test-apache1-${DOCKER1_PORT}" + docker run --name "${DOCKER1_NAME}" ${RUN_OPTIONS} --rm -e MYVAR=foo -e PHP_INI_MEMORY_LIMIT=2G -p "${DOCKER1_PORT}:80" -d -v "${SCRIPT_DIR}/assets/":/var/www/html \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" > /dev/null + assert_equals "0" "$?" "Docker run failed" + # SETUP apache2 + export DOCKER2_PORT="$(unused_port)" + export DOCKER2_NAME="test-apache2-${DOCKER2_PORT}" + docker run --name "${DOCKER2_NAME}" ${RUN_OPTIONS} --rm -e MYVAR=foo -e APACHE_DOCUMENT_ROOT=apache -p "${DOCKER2_PORT}:80" -d -v "${SCRIPT_DIR}/assets/":/var/www/html \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" > /dev/null + assert_equals "0" "$?" "Docker run failed" + # SETUP apache3 + export DOCKER3_PORT="$(unused_port)" + export DOCKER3_NAME="test-apache3-${DOCKER3_PORT}" + docker run --name "${DOCKER3_NAME}" ${RUN_OPTIONS} --rm -e MYVAR=foo -e APACHE_DOCUMENT_ROOT=/var/www/foo/apache -p "${DOCKER3_PORT}:80" -d -v "${SCRIPT_DIR}/assets/":/var/www/foo \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" > /dev/null + assert_equals "0" "$?" "Docker run failed" + # Let's wait for Apache to start + waitfor http://localhost:${DOCKER1_PORT} + waitfor http://localhost:${DOCKER2_PORT} + waitfor http://localhost:${DOCKER3_PORT} +} + +teardown_suite() { + docker stop "${DOCKER1_NAME}" "${DOCKER2_NAME}" "${DOCKER3_NAME}" > /dev/null 2>&1 +} diff --git a/tests-suite/variant-fpm.sh b/tests-suite/variant-fpm.sh new file mode 100755 index 00000000..714cafb5 --- /dev/null +++ b/tests-suite/variant-fpm.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +. ./config + +if [[ $VARIANT != fpm* ]]; then + echo "-- There is not an 'fpm' variant" + return 0; +fi; +############################################################ +## Test if environment starts without errors +############################################################ +test_start() { + docker run --name test-fpm1 ${RUN_OPTIONS} --rm -e MYVAR=foo -e PHP_INI_MEMORY_LIMIT=2G -p "9001:9000" -d -v "${SCRIPT_DIR}/assets/":/var/www/html \ + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT}" > /dev/null + assert_equals "0" "$?" "Docker run failed" + # Let's wait for FPM to start + sleep 3 + # If the container is still up, it will not fail when stopping. + docker stop test-fpm1 > /dev/null 2>&1 + assert_equals "0" "$?" "Docker stop failed" +} + +teardown_suite() { + docker stop test-fpm1 > /dev/null 2>&1 +} diff --git a/tests/apache/composer.json b/tests/apache/composer.json deleted file mode 100644 index d7679096..00000000 --- a/tests/apache/composer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "autoload": { - "psr-4": { - "\\": "." - } - } -} diff --git a/tests/slim_onbuild/Dockerfile b/tests/slim_onbuild/Dockerfile deleted file mode 100644 index ce94a053..00000000 --- a/tests/slim_onbuild/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -ARG BRANCH -ARG BRANCH_VARIANT -ARG PHP_VERSION - -ARG PHP_EXTENSIONS="pdo_pgsql pdo_sqlite" -FROM thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT} diff --git a/tests/slim_onbuild_composer/Dockerfile b/tests/slim_onbuild_composer/Dockerfile deleted file mode 100644 index 241f03eb..00000000 --- a/tests/slim_onbuild_composer/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -ARG BRANCH -ARG BRANCH_VARIANT -ARG PHP_VERSION - -ARG PHP_EXTENSIONS="gd" -FROM thecodingmachine/php:${PHP_VERSION}-${BRANCH}-slim-${BRANCH_VARIANT} - -COPY composer.json composer.json - -# Let's check that GD is available. -RUN composer install diff --git a/tests/slim_onbuild_composer/composer.json b/tests/slim_onbuild_composer/composer.json deleted file mode 100644 index 71ea8641..00000000 --- a/tests/slim_onbuild_composer/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "ext-gd": "*" - } -} diff --git a/utils/Dockerfile.blueprint b/utils/Dockerfile.blueprint index 8034526f..a3371931 100644 --- a/utils/Dockerfile.blueprint +++ b/utils/Dockerfile.blueprint @@ -1,10 +1,15 @@ +#syntax=docker/dockerfile-upstream:1 ARG INSTALL_CRON=1 ARG INSTALL_COMPOSER=1 ARG PHP_VERSION ARG GLOBAL_VERSION +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-slim-{{ .Orbit.variant }} as baseapp +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-slim-{{ .Orbit.variant }}" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH diff --git a/utils/Dockerfile.node.blueprint b/utils/Dockerfile.node.blueprint index 2f959b1d..5922ac60 100644 --- a/utils/Dockerfile.node.blueprint +++ b/utils/Dockerfile.node.blueprint @@ -1,9 +1,15 @@ -FROM thecodingmachine/php:${PHP_VERSION}-${GLOBAL_VERSION}-{{ .Orbit.variant }} as baseapp +#syntax=docker/dockerfile-upstream:1 +ARG REPO="thecodingmachine/php" +ARG TAG_PREFIX="" +ARG FROM_IMAGE="${REPO}:${TAG_PREFIX}:${PHP_VERSION}-${GLOBAL_VERSION}-{{ .Orbit.variant }}" +FROM $FROM_IMAGE LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG TARGETOS ARG TARGETARCH ARG BLACKFIRE_VERSION=1 +ARG NODE_VERSION=16 USER root @@ -11,14 +17,14 @@ ENV BLACKFIRE_VERSION=${BLACKFIRE_VERSION} RUN apt-get update && \ apt-get install -y --no-install-recommends gnupg && \ - curl -sL https://deb.nodesource.com/setup_{{ .Orbit.node_version }}.x | bash - && \ + curl -sL https://deb.nodesource.com/setup_${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" .Orbit.node_version }}@^6.14{{end}} && \ + if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ 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 21f6874d..4c14d2f8 100644 --- a/utils/Dockerfile.slim.blueprint +++ b/utils/Dockerfile.slim.blueprint @@ -1,5 +1,7 @@ +#syntax=docker/dockerfile-upstream:1 FROM ubuntu:20.04 LABEL authors="Julien Neuhart , David Négrier " +SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Fixes some weird terminal issues such as broken clear / CTRL+L #ENV TERM=linux @@ -52,7 +54,6 @@ RUN apt-get update \ php${PHP_VERSION}-xml \ php${PHP_VERSION}-zip \ && if [[ "${PHP_VERSION}" =~ ^7 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ - && if [[ "${PHP_VERSION}" =~ ^8 ]]; then apt-get install -y --no-install-recommends php${PHP_VERSION}-json; fi \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* @@ -209,8 +210,8 @@ EXPOSE 80 ENV APACHE_DOCUMENT_ROOT= -RUN sed -ri -e 's!/var/www/html!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf -RUN sed -ri -e 's!/var/www/!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf +RUN sed -ri -e 's!/var/www/html!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf && \ + sed -ri -e 's!/var/www/!${ABSOLUTE_APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf # Let's remove the default Apache php.ini file (it will be copied from TEMPLATE_PHP_INI) RUN rm /etc/php/${PHP_VERSION}/apache2/php.ini @@ -232,8 +233,8 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* # Let's remove the default PHP-FPM php.ini file (it will be copied from TEMPLATE_PHP_INI) -RUN rm /etc/php/${PHP_VERSION}/fpm/php.ini -RUN ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm +RUN rm /etc/php/${PHP_VERSION}/fpm/php.ini && \ + ln -s /usr/sbin/php-fpm${PHP_VERSION} /usr/sbin/php-fpm COPY utils/fpm-docker.conf /etc/php/${PHP_VERSION}/fpm/pool.d/docker.conf COPY utils/fpm-zz-docker.conf /etc/php/${PHP_VERSION}/fpm/pool.d/zz-docker.conf {{end}} @@ -269,7 +270,7 @@ USER docker # | We create an empty known_host file and we launch the ssh-agent # | -RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval $(ssh-agent -s) +RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval "$(ssh-agent -s)" # |-------------------------------------------------------------------------- @@ -308,11 +309,12 @@ RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/ ENV IMAGE_VARIANT={{ .Orbit.variant }} -# Add Tini (to be able to stop the container with ctrl-c). -# See: https://github.com/krallin/tini -ENV TINI_VERSION v0.16.1 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini -RUN chmod +x /tini +## Add Tini (to be able to stop the container with ctrl-c). +## See: https://github.com/krallin/tini +## FIX https://github.com/krallin/tini/pull/67 +#ENV TINI_VERSION v0.19.0 +#ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini +#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 @@ -330,8 +332,8 @@ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] {{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 +RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf && \ + a2enconf servername CMD ["apache2-foreground"] @@ -365,7 +367,7 @@ RUN ln -s /etc/php/${PHP_VERSION}/mods-available/generated_conf.ini /etc/php/${P sed -i 's/^group = www-data/;group = www-data/g' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \ sed -i 's#listen = /run/php/php${PHP_VERSION}-fpm.sock#;listen = /run/php/php${PHP_VERSION}-fpm.sock#g' /etc/php/${PHP_VERSION}/fpm/pool.d/www.conf && \ sed -i "s#pid = /run/php/php${PHP_VERSION}-fpm.pid#;pid = /run/php/php${PHP_VERSION}-fpm.pid#g" /etc/php/${PHP_VERSION}/fpm/php-fpm.conf && \ - if [ "$PHP_VERSION" = "7.2" ]; then \ + if [[ "$PHP_VERSION" = "7.2" ]]; then \ sed -i 's/^log_limit =/;log_limit =/g' /etc/php/${PHP_VERSION}/fpm/pool.d/docker.conf && \ sed -i 's/^decorate_workers_output =/;decorate_workers_output =/g' /etc/php/${PHP_VERSION}/fpm/pool.d/docker.conf; \ fi @@ -386,22 +388,21 @@ ONBUILD RUN sudo -E PHP_EXTENSIONS="$PHP_EXTENSIONS" /usr/local/bin/install_sele # | # | Supercronic is a drop-in replacement for cron (for containers). # | -ENV SUPERCRONIC_OPTIONS= +ENV SUPERCRONIC_OPTIONS="" ONBUILD ARG INSTALL_CRON ONBUILD RUN if [ -n "$INSTALL_CRON" ]; then \ - SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-$TARGETOS-$TARGETARCH \ - && 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 - \ - && chmod +x "$SUPERCRONIC" \ - && sudo mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ - && sudo ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic; \ - fi; + SUPERCRONIC="supercronic-${TARGETOS}-${TARGETARCH}" \ + && SUPERCRONIC_URL="https://github.com/aptible/supercronic/releases/download/v0.1.9/${SUPERCRONIC}" \ + && echo ${SUPERCRONIC_URL} \ + && if [ "$TARGETARCH" = "arm64" ]; then SUPERCRONIC_SHA1SUM=e2714c43e7781bf1579c85aa61259245f56dbba1; \ + elif [ "$TARGETARCH" = "amd64" ]; then SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85; \ + else echo "Target arch '${TARGETARCH}' is not supported"; exit 1; fi \ + && curl -fsSLO "${SUPERCRONIC_URL}" \ + && 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; \ + fi # |-------------------------------------------------------------------------- @@ -423,6 +424,7 @@ ONBUILD RUN if [ -n "$NODE_VERSION" ]; then \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list && \ sudo apt-get update && \ sudo apt-get install -y --no-install-recommends yarn && \ + if [[ "${NODE_VERSION}" == "10" ]]; then npm install -g npm@^6.14; else npm install -g npm; fi && \ sudo apt-get clean && \ sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*; \ fi; diff --git a/utils/README.blueprint.md b/utils/README.blueprint.md index ee651d9b..990b386e 100644 --- a/utils/README.blueprint.md +++ b/utils/README.blueprint.md @@ -103,9 +103,9 @@ This list can be outdated, you can verify by executing : `docker run --rm -it th - *mcrypt* is not available anymore in PHP 7.3+ - *weakref* is not compatible with PHP 7.3+ (but weak references were added to the PHP core in PHP 7.4) -- *sybase* extension is not available in v4 (use v3) - *event*, *gnupg* are not available in PHP 8.0+ -- *blackfire*, *gettext*, *ev*, *rdkafka*, *swoole* are not available in PHP 8.1+ +- *gettext*, *ev*, *rdkafka*, *swoole* are not available in PHP 8.1+ +- *ev*, *rdkafka*, *snmp*, *swoole* are not available in all `ARM64` images (build time is too long : it's possible to install manually as required) ### Enabling/disabling extensions in the fat image diff --git a/utils/docker-bake.blueprint.hcl b/utils/docker-bake.blueprint.hcl index 616bb200..7cf60788 100644 --- a/utils/docker-bake.blueprint.hcl +++ b/utils/docker-bake.blueprint.hcl @@ -20,14 +20,15 @@ group "php{{ $phpV | replace "." "" }}" { }{{end}} variable "REPO" {default = "thecodingmachine/php"} +variable "TAG_PREFIX" {default = ""} variable "PHP_PATCH_MINOR" {default = ""} variable "GLOBAL_VERSION" {default = "v4"} function "tag" { - params = [PHP_VERSION, VARIANT, PHP_MINOR] + params = [PHP_VERSION, VARIANT] result = [ - "${REPO}:${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}", - notequal("",PHP_MINOR) ? "${REPO}:${PHP_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "", + "${REPO}:${TAG_PREFIX}${PHP_VERSION}-${GLOBAL_VERSION}-${VARIANT}", + notequal("",PHP_PATCH_MINOR) ? "${REPO}:${TAG_PREFIX}${PHP_PATCH_MINOR}-${GLOBAL_VERSION}-${VARIANT}": "", ] } @@ -36,13 +37,10 @@ target "default" { args = { GLOBAL_VERSION = "${GLOBAL_VERSION}" } - platforms = ["linux/amd64"] + #platforms = ["linux/amd64", "linux/arm64"] + platforms = [BAKE_LOCAL_PLATFORM] pull = true - #output = ["customDir"] - #output = ["type=tar,dest=myimage.tar"] - output = ["type=docker"] # load in local docker - #output = ["type=registry"] # push - #output = ["type=image"] # push also ? + output = ["type=docker"] # export in local docker } {{range $phpV := $versions}}{{range $variant := $variants}} @@ -52,7 +50,7 @@ target "default" { # thecodingmachine/php:{{ $phpV }}-v4-slim-{{ $variant }} target "php{{ $phpV | replace "." "" }}-slim-{{ $variant }}" { inherits = ["default"] - tags = tag("{{ $phpV }}", "slim-{{ $variant }}", "${PHP_PATCH_MINOR}") + tags = tag("{{ $phpV }}", "slim-{{ $variant }}") dockerfile = "Dockerfile.slim.{{ $variant }}" args = { PHP_VERSION = "{{ $phpV }}" @@ -62,29 +60,32 @@ 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}") + tags = tag("{{ $phpV }}", "{{ $variant }}") dockerfile = "Dockerfile.{{ $variant }}" args = { PHP_VERSION = "{{ $phpV }}" VARIANT = "{{ $variant }}" + FROM_IMAGE = "slim" + } + contexts = { + slim = "target:php{{ $phpV | replace "." "" }}-slim-{{ $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 }}" + tags = tag("{{ $phpV }}", "{{ $variant }}-node{{ $nodeV }}") + dockerfile = "Dockerfile.{{ $variant }}.node" args = { PHP_VERSION = "{{ $phpV }}" VARIANT = "{{ $variant }}-node{{ $nodeV }}" + FROM_IMAGE = "fat" + NODE_VERSION = "{{ $nodeV }}" + } + contexts = { + fat = "target:php{{ $phpV | replace "." "" }}-{{ $variant }}" } } {{ end }}{{ end }}{{ end }} diff --git a/utils/docker-entrypoint.sh b/utils/docker-entrypoint.sh index c719a4a3..6b528648 100755 --- a/utils/docker-entrypoint.sh +++ b/utils/docker-entrypoint.sh @@ -2,4 +2,5 @@ set -e -exec "sudo" "-E" "/tini" "-g" "-s" "--" "/usr/local/bin/docker-entrypoint-as-root.sh" "$@"; +#exec "sudo" "-E" "/tini" "-g" "-s" "--" "/usr/local/bin/docker-entrypoint-as-root.sh" "$@"; +exec "sudo" "-E" "/usr/local/bin/docker-entrypoint-as-root.sh" "$@"; diff --git a/utils/generate_cron.php b/utils/generate_cron.php index 96e14f4e..e99db0f5 100644 --- a/utils/generate_cron.php +++ b/utils/generate_cron.php @@ -4,8 +4,6 @@ * The script is run on each start of the container. */ -$tiniPid = $argv[1]; - $found = false; foreach ($_SERVER as $key => $command) { diff --git a/utils/utils.php b/utils/utils.php index 42d8f942..075429d5 100644 --- a/utils/utils.php +++ b/utils/utils.php @@ -10,7 +10,8 @@ */ function getAvailableExtensions(): array { - return array_map(function(string $fileName) { return basename($fileName);}, glob('/var/lib/php/modules/'.getenv('PHP_VERSION').'/registry/*')); + //return array_map(function(string $fileName) { return basename($fileName);}, glob('/var/lib/php/modules/'.getenv('PHP_VERSION').'/registry/*')); + return array_map(function(string $fileName) { return preg_replace('/\.ini$/i', '', basename($fileName));}, glob('/etc/php/'.getenv('PHP_VERSION').'/mods-available/*.ini')); } /**