diff --git a/.dive-ci.yml b/.dive-ci.yml new file mode 100644 index 0000000..b70b867 --- /dev/null +++ b/.dive-ci.yml @@ -0,0 +1,13 @@ +rules: + # If the efficiency is measured below X%, mark as failed. + # Expressed as a ratio between 0-1. + lowestEfficiency: 0.95 + + # If the amount of wasted space is at least X or larger than X, mark as failed. + # Expressed in B, KB, MB, and GB. + highestWastedBytes: 20MB + + # If the amount of wasted space makes up for X% or more of the image, mark as failed. + # Note: the base image layer is NOT included in the total image size. + # Expressed as a ratio between 0-1; fails if the threshold is met or crossed. + highestUserWastedPercent: 0.20 diff --git a/.github/workflows/build-latest.yml b/.github/workflows/build-latest.yml index 873aad2..f9ecca7 100644 --- a/.github/workflows/build-latest.yml +++ b/.github/workflows/build-latest.yml @@ -1,43 +1,213 @@ --- +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: # yamllint disable-line rule:truthy workflow_dispatch: pull_request: branches: - master +env: + DOCKER_NAMESPACE: wayofdev/php-base + GHCR_NAMESPACE: ghcr.io/wayofdev/docker-php-base + name: ๐Ÿš€ Build docker images with latest tag jobs: - # https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/expressions#example-returning-a-json-object - prepare: - runs-on: "ubuntu-latest" - outputs: - matrix: ${{ steps.matrix.outputs.matrix }} + build: + strategy: + fail-fast: false + matrix: + os_name: ["alpine"] + php_version: ["8.1", "8.2"] + php_type: ["fpm", "cli", "supervisord"] + builder: [{arch: "amd64", os: "ubuntu-latest"}, {arch: "arm64", os: "ubuntu-latest"}] + runs-on: ${{ matrix.builder.os }} steps: - - name: โš™๏ธ Generate matrix - id: matrix + + - name: ๐ŸŒŽ Set environment variables run: | - echo 'matrix={ - "os_name": ["alpine"], - "php_version": ["8.1", "8.2"], - "php_type": ["fpm", "cli", "supervisord"] - }' | tr -d '\n' >> $GITHUB_OUTPUT + php_version="${{ matrix.php_version }}" + tag="${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-${{ matrix.builder.arch }}" + php_version_slug="${php_version//./}" + target="php-${php_version_slug}-${{ matrix.php_type }}-${{ matrix.os_name }}" + echo "TARGET=${target}" >> $GITHUB_ENV + echo "PLATFORM_CACHE_TAG=${tag}" >> $GITHUB_ENV - build: - needs: prepare - strategy: - matrix: ${{ fromJson(needs.prepare.outputs.matrix )}} - uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master - with: - os: "ubuntu-latest" - push-to-hub: true - image-namespace: "wayofdev/php-base" - image-template-path: "./dist/base" - image-template: ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }} - image-version: latest - secrets: - docker-username: ${{ secrets.DOCKER_USERNAME }} - docker-password: ${{ secrets.DOCKER_TOKEN }} + - name: ๐Ÿ“ฆ Check out the codebase + uses: actions/checkout@v4 + + - name: ๐Ÿค– Generate dist files + run: ansible-playbook src/playbook.yml -l ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }} + + - name: ๐Ÿ’ป Set up Docker for MacOS + if: ${{ matrix.builder.os == 'macos-latest' }} + uses: docker-practice/actions-setup-docker@master + + - name: ๐Ÿ–ฅ๏ธ Setup docker QEMU + uses: docker/setup-qemu-action@v3 + + - name: ๐Ÿ› ๏ธ Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: "--debug" + + - name: ๐Ÿณ Extract docker meta data + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.DOCKER_NAMESPACE }} + ${{ env.GHCR_NAMESPACE }} + tags: | + type=raw,event=branch,value=latest + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + flavor: | + latest=false + prefix=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}- + + - name: โš™๏ธ Rename meta bake definition file + run: | + mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta-${{ env.PLATFORM_CACHE_TAG }}.json" + cat "/tmp/bake-meta-${{ env.PLATFORM_CACHE_TAG }}.json" + + - name: ๐Ÿ“ค Upload meta bake definition + uses: actions/upload-artifact@v4 + with: + name: bake-meta-${{ env.PLATFORM_CACHE_TAG }} + path: /tmp/bake-meta-*.json + if-no-files-found: error + retention-days: 1 + + - name: ๐Ÿ”‘ Login to docker-hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: ๐Ÿ”‘ Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: ๐Ÿš€ Bake image and push to docker-hub and GHCR + id: bake + uses: docker/bake-action@v4 + with: + targets: ${{ env.TARGET }} + files: | + ./docker-bake.hcl + /tmp/bake-meta-${{ env.PLATFORM_CACHE_TAG }}.json + set: | + *.tags= + *.platform=linux/${{ matrix.builder.arch }} + *.cache-from=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }} + *.cache-to=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }} + *.output=type=image,"name=${{ env.DOCKER_NAMESPACE }},${{ env.GHCR_NAMESPACE }}",push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }} + + - name: ๐Ÿ” Debug Bake Metadata Output + run: | + echo "${{ steps.bake.outputs.metadata }}" + + - name: ๐Ÿ” Debug baked image + run: | + tag=$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' /tmp/bake-meta-${{ env.PLATFORM_CACHE_TAG }}.json) + if [ -z "$tag" ]; then + echo "Tag is empty, skipping inspect." + else + echo "Tag extracted: $tag" + docker buildx imagetools inspect ${{ env.DOCKER_NAMESPACE }}:${tag} + fi + + - name: ๐Ÿ“ฅ Export digest + run: | + mkdir -p /tmp/digests + echo "Bake Metadata: ${{ steps.bake.outputs.metadata }}" + digest=$(echo '${{ steps.bake.outputs.metadata }}' | jq -r '.["${{ env.TARGET }}"]["containerimage.digest"]') + if [[ -z "$digest" || "$digest" == "null" ]]; then + echo "Digest not found." + exit 1 + fi + echo "Digest: $digest" + touch "/tmp/digests/${digest#sha256:}" + + - name: ๐Ÿ“ค Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ env.PLATFORM_CACHE_TAG }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + needs: build + runs-on: ubuntu-latest + steps: + + - name: ๐Ÿ“ฅ Download meta bake definitions + uses: actions/download-artifact@v4 + with: + pattern: bake-meta-* + path: /tmp + + - name: ๐Ÿ“ฅ Download meta bake definitions + uses: actions/download-artifact@v4 + with: + pattern: digests-* + path: /tmp/digests/* + + - name: Print all download artifact files + run: | + ls -la /tmp + ls -la /tmp/digests + + - name: ๐Ÿ”‘ Login to docker-hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: ๐Ÿ”‘ Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: ๐Ÿ–ฅ๏ธ Setup docker QEMU + uses: docker/setup-qemu-action@v3 + + - name: ๐Ÿ› ๏ธ Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: "--debug" + + - name: Create manifest list and push + run: | + # Aggregate all tags from the meta files + TAGS=$(jq -r '.target."docker-metadata-action".tags[]' /tmp/meta/bake-meta-*.json | sort -u) + + # Loop through each tag and create a manifest list + for TAG in $TAGS; do + FULL_TAGS=() + for FILE in /tmp/meta/bake-meta-*.json; do + if jq -e --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE > /dev/null; then + # Extract the repository and digest for the current platform + REPO=$(jq -r --arg TAG "$TAG" '.target."docker-metadata-action".tags[] | select(. == $TAG)' $FILE | cut -d':' -f1) + DIGEST=$(jq -r '.["'$REPO'"]["containerimage.digest"]' $FILE) + FULL_TAGS+=("$REPO@$DIGEST") + fi + done + + # Create and push the manifest list for the current tag + docker buildx imagetools create "${FULL_TAGS[@]}" -t "$TAG" + done ... diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 57d7d17..8721a6a 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -20,7 +20,7 @@ jobs: run: | echo 'matrix={ "os_name": ["alpine"], - "php_version": ["8.1", "8.2"], + "php_version": ["8.1", "8.2", "8.3"], "php_type": ["fpm", "cli", "supervisord"] }' | tr -d '\n' >> $GITHUB_OUTPUT diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b8adb97 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,111 @@ +--- + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - master + paths-ignore: + - '**.md' + pull_request: + paths-ignore: + - '**.md' + +env: + DOCKER_NAMESPACE: wayofdev/php-base + GHCR_NAMESPACE: ghcr.io/wayofdev/docker-php-base + +name: ๐Ÿงช Test Docker images + +jobs: + test: + strategy: + fail-fast: false + matrix: + os_name: ["alpine"] + php_version: ["8.1", "8.2", "8.3"] + php_type: ["fpm", "cli", "supervisord"] + builder: [{arch: "amd64", os: "ubuntu-latest"}] + runs-on: ${{ matrix.builder.os }} + steps: + + - name: ๐ŸŒŽ Set environment variables + run: | + php_version="${{ matrix.php_version }}" + tag="${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}-${{ matrix.builder.arch }}" + php_version_slug="${php_version//./}" + target="php-${php_version_slug}-${{ matrix.php_type }}-${{ matrix.os_name }}" + echo "TARGET=${target}" >> $GITHUB_ENV + echo "PLATFORM_CACHE_TAG=${tag}" >> $GITHUB_ENV + + - name: ๐Ÿ“ฆ Check out the codebase + uses: actions/checkout@v4 + + - name: ๐Ÿ› ๏ธ Install goss and dgoss + uses: e1himself/goss-installation-action@v1.2.1 + with: + version: v0.4.6 + + - name: ๐Ÿค– Generate dist files + run: ansible-playbook src/playbook.yml -l ${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }} + + - name: ๐Ÿ–ฅ๏ธ Setup docker QEMU + uses: docker/setup-qemu-action@v3 + + - name: ๐Ÿ› ๏ธ Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + buildkitd-flags: "--debug" + + - name: ๐Ÿ”‘ Login to docker-hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: ๐Ÿ”‘ Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: ๐Ÿณ Extract docker meta data + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.DOCKER_NAMESPACE }} + ${{ env.GHCR_NAMESPACE }} + tags: | + type=raw,event=branch,value=latest + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + flavor: | + latest=false + prefix=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }}- + + - name: ๐Ÿงช Bake image for testing + id: bake + uses: docker/bake-action@v4 + with: + targets: ${{ env.TARGET }} + files: | + ./docker-bake.hcl + ${{ steps.meta.outputs.bake-file }} + set: | + *.tags= + *.platform=linux/${{ matrix.builder.arch }} + *.cache-from=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }} + *.cache-to=type=gha,scope=build-${{ env.PLATFORM_CACHE_TAG }} + *.output=type=docker,"name=${{ env.DOCKER_NAMESPACE }},${{ env.GHCR_NAMESPACE }}",name-canonical=true,push=false + + - name: ๐Ÿงช Test Docker image + run: | + export IMAGE_TEMPLATE=${{ matrix.php_version }}-${{ matrix.php_type }}-${{ matrix.os_name }} + export IMAGE_TAG=${{ env.DOCKER_NAMESPACE }}:latest + make test diff --git a/Makefile b/Makefile index 240dc2e..e04ac82 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ export DOCKER_BUILDKIT ?= 1 export COMPOSE_DOCKER_CLI_BUILD ?= 1 IMAGE_NAMESPACE ?= wayofdev/php-base -IMAGE_TEMPLATE ?= 8.2-fpm-alpine +IMAGE_TEMPLATE ?= 8.3-fpm-alpine IMAGE_TAG ?= $(IMAGE_NAMESPACE):$(IMAGE_TEMPLATE)-latest DOCKERFILE_DIR ?= ./dist/base/$(IMAGE_TEMPLATE) @@ -83,7 +83,7 @@ PHONY: build-from-cache test: ## Run dgoss tests over docker images set -eux - GOSS_FILES_STRATEGY=cp GOSS_FILES_PATH=$(DOCKERFILE_DIR) dgoss run -t $(IMAGE_TAG) + GOSS_WAIT_OPTS="-r 40s -s 2s > /dev/stdout" GOSS_FILES_STRATEGY=cp GOSS_FILES_PATH=$(DOCKERFILE_DIR) dgoss run -t $(IMAGE_TAG) .PHONY: test pull: ## Pulls docker image from upstream @@ -138,4 +138,7 @@ lint-docker: ## Run hadolint linter over dist Dockerfiles hadolint -V ./dist/base/8.2-cli-alpine/Dockerfile hadolint -V ./dist/base/8.2-fpm-alpine/Dockerfile hadolint -V ./dist/base/8.2-fpm-supervisord/Dockerfile + hadolint -V ./dist/base/8.3-cli-alpine/Dockerfile + hadolint -V ./dist/base/8.3-fpm-alpine/Dockerfile + hadolint -V ./dist/base/8.3-fpm-supervisord/Dockerfile .PHONY: lint-docker diff --git a/README.md b/README.md index 1182f27..d1cdaac 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,9 @@ $ make build IMAGE_TEMPLATE="8.1-supervisord-alpine" $ make build IMAGE_TEMPLATE="8.2-cli-alpine" $ make build IMAGE_TEMPLATE="8.2-fpm-alpine" $ make build IMAGE_TEMPLATE="8.2-supervisord-alpine" +$ make build IMAGE_TEMPLATE="8.3-cli-alpine" +$ make build IMAGE_TEMPLATE="8.3-fpm-alpine" +$ make build IMAGE_TEMPLATE="8.3-supervisord-alpine" ```
@@ -185,6 +188,9 @@ $ make test IMAGE_TEMPLATE="8.1-supervisord-alpine" $ make test IMAGE_TEMPLATE="8.2-cli-alpine" $ make test IMAGE_TEMPLATE="8.2-fpm-alpine" $ make test IMAGE_TEMPLATE="8.2-supervisord-alpine" +$ make test IMAGE_TEMPLATE="8.3-cli-alpine" +$ make test IMAGE_TEMPLATE="8.3-fpm-alpine" +$ make test IMAGE_TEMPLATE="8.3-supervisord-alpine" ```
diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 0000000..d233277 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,110 @@ +## Documentation: +## https://docs.docker.com/build/ci/github-actions/multi-platform/#with-bake + +variable "DEFAULT_TAG" { default = "wayofdev/php-base:local" } + +## Special target: https://github.com/docker/metadata-action#bake-definition +target "docker-metadata-action" { + tags = ["${DEFAULT_TAG}"] +} + +########################### +## PHP 8.1 +########################### +target "php-81-cli-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.1-cli-alpine" + dockerfile = "./Dockerfile" +} + +target "php-81-fpm-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.1-fpm-alpine" + dockerfile = "./Dockerfile" +} + +target "php-81-supervisord-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.1-supervisord-alpine" + dockerfile = "./Dockerfile" +} + +########################### +## PHP 8.2 +########################### +target "php-82-cli-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.2-cli-alpine" + dockerfile = "./Dockerfile" +} + +target "php-82-fpm-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.2-fpm-alpine" + dockerfile = "./Dockerfile" +} + +target "php-82-supervisord-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.2-supervisord-alpine" + dockerfile = "./Dockerfile" +} + +########################### +## PHP 8.3 +########################### +target "php-83-cli-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.3-cli-alpine" + dockerfile = "./Dockerfile" +} + +target "php-83-fpm-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.3-fpm-alpine" + dockerfile = "./Dockerfile" +} + +target "php-83-supervisord-alpine" { + inherits = ["docker-metadata-action"] + context = "dist/base/8.3-supervisord-alpine" + dockerfile = "./Dockerfile" +} + +group "all" { + targets = [ + "php-81-cli-alpine", + "php-81-fpm-alpine", + "php-81-supervisord-alpine", + "php-82-cli-alpine", + "php-82-fpm-alpine", + "php-82-supervisord-alpine", + "php-83-cli-alpine", + "php-83-fpm-alpine", + "php-83-supervisord-alpine", + ] +} + +group "php-81" { + targets = [ + "php-81-cli-alpine", + "php-81-fpm-alpine", + "php-81-supervisord-alpine", + ] +} + +group "php-82" { + targets = [ + "php-82-cli-alpine", + "php-82-fpm-alpine", + "php-82-supervisord-alpine", + ] +} + +group "php-83" { + targets = [ + "php-83-cli-alpine", + "php-83-fpm-alpine", + "php-83-supervisord-alpine", + ] +} diff --git a/src/Dockerfiles/base/Dockerfile.j2 b/src/Dockerfiles/base/Dockerfile.j2 index 010d05a..9859a36 100644 --- a/src/Dockerfiles/base/Dockerfile.j2 +++ b/src/Dockerfiles/base/Dockerfile.j2 @@ -23,12 +23,14 @@ LABEL "org.opencontainers.image.description"="PHP-{{ php_type|upper }} {{ php_ve ENV LANG="en_US.UTF-8" ENV LC_ALL="en_US.UTF-8" ENV LANGUAGE="en_US.UTF-8" +ENV IMAGICK_VERSION="3.7.0" ENV PHP_OPCACHE_ENABLE="{{ settings_opcache_ini.php_opcache_enable }}" ENV PHP_OPCACHE_ENABLE_CLI="{{ settings_opcache_ini.php_opcache_enable_cli }}" ENV PHP_TIMEZONE="{{ settings_php_ini.php_timezone }}" ENV PHP_POST_MAX_SIZE="{{ settings_php_ini.php_post_max_size }}" ENV PHP_MEMORY_LIMIT="{{ settings_php_ini.php_memory_limit }}" + {% if php_type == 'fpm' %} ENV PHPFPM_SLOWLOG_TIMEOUT="5s" {% endif %} diff --git a/src/Dockerfiles/base/goss.yaml.j2 b/src/Dockerfiles/base/goss.yaml.j2 index cd2e57c..541e611 100644 --- a/src/Dockerfiles/base/goss.yaml.j2 +++ b/src/Dockerfiles/base/goss.yaml.j2 @@ -8,19 +8,19 @@ file: /usr/local/etc/php-fpm.d/docker.conf: filetype: file exists: true - contains: + contents: - "Custom Config File" - "log_limit = 8192" /usr/local/etc/php-fpm.d/zz-docker.conf: filetype: file exists: true - contains: + contents: - "Custom Config File" - "daemonize = no" /usr/local/etc/php-fpm.d/www.conf: filetype: file exists: true - contains: + contents: - "Custom Config File" - "pm.max_children = 5" {% endif %} @@ -29,14 +29,14 @@ file: exists: true owner: www-data group: www-data - contains: + contents: - "date.timezone = UTC" /usr/local/etc/php/conf.d/opcache.ini: filetype: file exists: true owner: www-data group: www-data - contains: + contents: - "opcache.memory_consumption = 256" {% if php_type == 'fpm' %} port: @@ -52,12 +52,12 @@ process: /etc/supervisord.conf: filetype: file exists: true - contains: + contents: - "nodaemon = true" /tmp/supervisord.pid: filetype: file exists: true - contains: + contents: - "1" {% endif %} group: diff --git a/src/Dockerfiles/base/goss_wait_fpm.yaml b/src/Dockerfiles/base/goss_wait_fpm.yaml new file mode 100644 index 0000000..ce09ffe --- /dev/null +++ b/src/Dockerfiles/base/goss_wait_fpm.yaml @@ -0,0 +1,7 @@ +--- + +process: + php-fpm: + running: true + +... diff --git a/src/Dockerfiles/base/goss_wait.yaml b/src/Dockerfiles/base/goss_wait_supervisord.yaml similarity index 100% rename from src/Dockerfiles/base/goss_wait.yaml rename to src/Dockerfiles/base/goss_wait_supervisord.yaml diff --git a/src/group_vars/base.yml b/src/group_vars/base.yml index 6599517..47648f6 100644 --- a/src/group_vars/base.yml +++ b/src/group_vars/base.yml @@ -71,10 +71,22 @@ tpl_supervisord_configs: tpl_docker_tests: - src: Dockerfiles/base/goss.yaml.j2 dst: "../dist/base/{{ php_version }}-{{ php_type }}-{{ os_name }}/goss.yaml" - - src: Dockerfiles/base/goss_wait.yaml + +tpl_docker_fpm_tests: + - src: Dockerfiles/base/goss_wait_fpm.yaml + dst: "../dist/base/{{ php_version }}-fpm-{{ os_name }}/goss_wait.yaml" + +tpl_docker_supervisord_tests: + - src: Dockerfiles/base/goss_wait_supervisord.yaml dst: "../dist/base/{{ php_version }}-supervisord-{{ os_name }}/goss_wait.yaml" + # Enabled extensions +# These are added by default by install-php-extensions: +# - pdo +# - pdo_sqlite +# - curl +# - openssl ####################################### ext_native_enabled: - intl @@ -87,18 +99,12 @@ ext_native_enabled: - bcmath - exif - gd - - soap - - imap - - ldap ext_pecl_enabled: - redis - memcached - decimal - - imagick - - rdkafka - amqp - - protobuf - yaml ... diff --git a/src/inventory.yml b/src/inventory.yml index 9000698..8f56bfe 100644 --- a/src/inventory.yml +++ b/src/inventory.yml @@ -11,21 +11,21 @@ all: php_version: 7.4 php_type: cli os_name: alpine - os_version: 3.18 + os_version: 3.19 7.4-fpm-alpine: ansible_connection: local level: base php_version: 7.4 php_type: fpm os_name: alpine - os_version: 3.18 + os_version: 3.19 7.4-supervisord-alpine: ansible_connection: local level: base php_version: 7.4 php_type: supervisord os_name: alpine - os_version: 3.18 + os_version: 3.19 # PHP 8.0 8.0-cli-alpine: ansible_connection: local @@ -33,21 +33,21 @@ all: php_version: 8.0 php_type: cli os_name: alpine - os_version: 3.18 + os_version: 3.19 8.0-fpm-alpine: ansible_connection: local level: base php_version: 8.0 php_type: fpm os_name: alpine - os_version: 3.18 + os_version: 3.19 8.0-supervisord-alpine: ansible_connection: local level: base php_version: 8.0 php_type: supervisord os_name: alpine - os_version: 3.18 + os_version: 3.19 # PHP 8.1 8.1-cli-alpine: ansible_connection: local @@ -55,21 +55,21 @@ all: php_version: 8.1 php_type: cli os_name: alpine - os_version: 3.18 + os_version: 3.19 8.1-fpm-alpine: ansible_connection: local level: base php_version: 8.1 php_type: fpm os_name: alpine - os_version: 3.18 + os_version: 3.19 8.1-supervisord-alpine: ansible_connection: local level: base php_version: 8.1 php_type: supervisord os_name: alpine - os_version: 3.18 + os_version: 3.19 # PHP 8.2 8.2-cli-alpine: ansible_connection: local @@ -77,20 +77,42 @@ all: php_version: 8.2 php_type: cli os_name: alpine - os_version: 3.18 + os_version: 3.19 8.2-fpm-alpine: ansible_connection: local level: base php_version: 8.2 php_type: fpm os_name: alpine - os_version: 3.18 + os_version: 3.19 8.2-supervisord-alpine: ansible_connection: local level: base php_version: 8.2 php_type: supervisord os_name: alpine - os_version: 3.18 + os_version: 3.19 + # PHP 8.3 + 8.3-cli-alpine: + ansible_connection: local + level: base + php_version: 8.3 + php_type: cli + os_name: alpine + os_version: 3.19 + 8.3-fpm-alpine: + ansible_connection: local + level: base + php_version: 8.3 + php_type: fpm + os_name: alpine + os_version: 3.19 + 8.3-supervisord-alpine: + ansible_connection: local + level: base + php_version: 8.3 + php_type: supervisord + os_name: alpine + os_version: 3.19 ... diff --git a/src/roles/base/main.yml b/src/roles/base/main.yml index 667e3fc..477a8b9 100644 --- a/src/roles/base/main.yml +++ b/src/roles/base/main.yml @@ -65,7 +65,7 @@ with_items: - "{{ tpl_supervisord_configs }}" -- name: Generate Dockerfile Goss tests +- name: Generate Dockerfile Goss tests for non-supervisord ansible.builtin.template: src: "{{ item.src }}" dest: "{{ item.dst }}" @@ -73,5 +73,28 @@ mode: "0644" with_items: - "{{ tpl_docker_tests }}" + when: php_type == 'cli' + +- name: Generate Dockerfile Goss tests for fpm + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dst }}" + force: true + mode: "0644" + with_items: + - "{{ tpl_docker_tests }}" + - "{{ tpl_docker_fpm_tests }}" + when: php_type == 'fpm' + +- name: Generate Dockerfile Goss tests for supervisord + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dst }}" + force: true + mode: "0644" + with_items: + - "{{ tpl_docker_tests }}" + - "{{ tpl_docker_supervisord_tests }}" + when: php_type == 'supervisord' ...