From 217ef27f4bcdab17c98f6db1f0fa412aec8f1849 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Thu, 13 Nov 2025 20:39:10 -0300 Subject: [PATCH 01/11] feat: variations --- .github/workflows/docker-build.yaml | 56 +++++++++++++++ Dockerfile.pgsql | 103 ++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 Dockerfile.pgsql diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 229ab42..fe98dc6 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -28,6 +28,9 @@ jobs: uses: docker/metadata-action@v5 with: images: lojassimonetti/php-apache-oci8-composer + tags: | + type=ref,event=branch,enable=true + type=ref,event=tag,enable=true - name: Should push? id: shoudPush @@ -47,3 +50,56 @@ jobs: push: ${{ steps.shoudPush.outputs.match == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + push_children: + name: Push children Docker image to Docker Hub + runs-on: ubuntu-latest + + needs: + - push_to_registry + + strategy: + matrix: + variation: + - pgsql + + permissions: + packages: write + contents: read + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: lojassimonetti/php-apache-oci8-composer + tags: | + type=ref,event=branch,enable=true,suffix=-${{ matrix.variation }} + type=ref,event=tag,enable=true,suffix=-${{ matrix.variation }} + + - name: Should push? + id: shoudPush + run: | + if [[ ${{ github.event.ref }} =~ ^refs/heads/php[0-9]dot[0-9]$ ]]; then + echo "match=true" >> $GITHUB_OUTPUT + elif [[ ${{ github.event.ref }} = "refs/heads/master" ]]; then + echo "match=true" >> $GITHUB_OUTPUT + fi + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile.${{ matrix.variation }} + push: ${{ steps.shoudPush.outputs.match == 'true' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile.pgsql b/Dockerfile.pgsql new file mode 100644 index 0000000..d7fee14 --- /dev/null +++ b/Dockerfile.pgsql @@ -0,0 +1,103 @@ +# Container Base +FROM php:7.4-apache + +ENV http_proxy=${HTTP_PROXY} +ENV https_proxy=${HTTP_PROXY} +ENV NR_ENABLED=false +ENV NR_DISTRIBUTED_TRACING_ENABLED=false +ENV NR_APPLICATION_LOGGING_ENABLED=false +ENV NR_IGNORE_DEFAULT_EXCEPTION=false +ENV NR_IGNORED_EXECEPTIONS="" +ENV NR_APP_NAME="" +ENV NR_LICENSE_KEY="" +ENV NR_VERSION="" +ENV PHP_BUILD_DATE="20190902" +ENV PHP_OPCACHE_ENABLED=false +ENV SESSION_HANDLER=false +ENV SESSION_HANDLER_NAME="" +ENV SESSION_HANDLER_PATH="" +ENV XDEBUG_AUTOSTART=false +ENV XDEBUG_CONNECT_BACK=true +ENV XDEBUG_ENABLED=false +ENV XDEBUG_IDEKEY="docker" +ENV XDEBUG_VERSION="-3.1.6" +ENV XDEBUG_REMOTE_PORT=9000 +ENV PHP_EXTENSION_WDDX=1 +ENV PHP_OPENSSL=1 + +ENV CONTAINER_STARTED_LOCK=/var/lock/container.starting + +RUN apt-get update && apt-get install -y --no-install-recommends wget vim supervisor libfreetype6-dev libjpeg-dev libjpeg62-turbo-dev \ + libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \ + libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev libpq-dev \ + sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev && \ + rm -rf /var/lib/apt/lists/* + +RUN a2enmod rewrite unique_id headers + +RUN docker-php-ext-configure gd --with-jpeg \ + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql pdo_pgsql calendar exif gettext shmop soap sockets intl pcntl xsl ldap imap + +RUN echo "---> Adding Redis" && \ + pecl install redis && \ + docker-php-ext-enable redis + +RUN echo "---> Adding xDebug" && \ + pecl install "xdebug${XDEBUG_VERSION}" + +RUN echo "---> Adding Zip" && \ + pecl install zip && \ + docker-php-ext-enable zip + +RUN echo "---> Adding AMQP" && \ + pecl install amqp && \ + docker-php-ext-enable amqp + +RUN echo "---> Configure Opcache" && \ + docker-php-ext-install opcache && \ + echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini && \ + echo "opcache.enable_cli=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + +RUN apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests gnupg2 \ + && echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list \ + && wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add - \ + && sudo apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests newrelic-php5 \ + && NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 newrelic-install install \ + && chown www-data:www-data /usr/local/etc/php/conf.d/newrelic.ini && chmod a+rw /usr/local/etc/php/conf.d/newrelic.ini \ + && apt-get remove -y gnupg2 && rm -rf /var/lib/apt/lists/* \ + && echo "newrelic.distributed_tracing_enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ + && echo "newrelic.application_logging.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ + && echo "newrelic.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini + +RUN echo "---> Adding Tini" && \ + wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \ + chmod +x /tini + +RUN echo "---> Config sudoers" && \ + echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers + +RUN echo "---> Fix Logs permissions" && \ + chown -R www-data:www-data /var/log/apache2 + +RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer && \ + mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer + +COPY configs/ports.conf /etc/apache2/ports.conf +COPY configs/headers.conf /etc/apache2/conf-enabled/headers.conf +COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf +COPY apache-run.sh /usr/bin/apache-run +COPY ./bin /usr/bin/ + +RUN chmod a+x \ + /usr/bin/apache-run \ + /usr/bin/post-startup-hook + +USER www-data + +WORKDIR "/var/www/html" + +EXPOSE 8080 9001 + +CMD ["/tini", "--", "/usr/bin/apache-run"] From 1ebfd7fb2cbe80551688b715da688926d802736a Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Thu, 13 Nov 2025 21:05:14 -0300 Subject: [PATCH 02/11] feat: swoole-run --- Dockerfile.swoole | 102 ++++++++++++++++++++++++++++++++++++++++++++++ bin/swoole-run.sh | 7 ++++ 2 files changed, 109 insertions(+) create mode 100644 Dockerfile.swoole create mode 100644 bin/swoole-run.sh diff --git a/Dockerfile.swoole b/Dockerfile.swoole new file mode 100644 index 0000000..45476e2 --- /dev/null +++ b/Dockerfile.swoole @@ -0,0 +1,102 @@ +# Container Base +FROM php:8.3-apache-bookworm + +ENV \ + NR_ENABLED=false \ + NR_APP_NAME="" \ + NR_LICENSE_KEY="" \ + NR_VERSION="" \ + PHP_BUILD_DATE="20211130" \ + PHP_OPCACHE_ENABLED=false \ + SESSION_HANDLER=false \ + SESSION_HANDLER_NAME="" \ + SESSION_HANDLER_PATH="" \ + XDEBUG_AUTOSTART=false \ + XDEBUG_CONNECT_BACK=true \ + XDEBUG_ENABLED=false \ + XDEBUG_IDEKEY="docker" \ + XDEBUG_VERSION="-3.3.2" \ + REDIS_VERSION="-5.3.7" \ + XDEBUG_REMOTE_PORT=9000 \ + PHP_EXTENSION_WDDX=1 \ + PHP_OPENSSL=1 \ + CONTAINER_STARTED_LOCK=/var/lock/container.starting + +RUN apt-get update && apt-get install -y --no-install-recommends wget vim supervisor libfreetype6-dev libjpeg-dev libjpeg62-turbo-dev \ + libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \ + libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev \ + sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev musl-dev && \ + rm -rf /var/lib/apt/lists/* + +RUN docker-php-ext-configure gd --with-jpeg \ + && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ + && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap imap ftp + +RUN echo "---> Adding Redis" && \ + pecl install redis${REDIS_VERSION} && \ + docker-php-ext-enable redis + +RUN echo "---> Adding xDebug" && \ + pecl install "xdebug${XDEBUG_VERSION}" + +RUN echo "---> Adding Zip" && \ + pecl install zip && \ + docker-php-ext-enable zip + +RUN echo "---> Adding AMQp" && \ + apt-get update && apt-get install -y -f librabbitmq-dev libssh-dev \ + && docker-php-source extract \ + && mkdir /usr/src/php/ext/amqp \ + && curl -L https://github.com/php-amqp/php-amqp/archive/master.tar.gz | tar -xzC /usr/src/php/ext/amqp --strip-components=1 \ + && docker-php-ext-install amqp \ + && docker-php-ext-enable amqp + +RUN echo "---> Configure Opcache" && \ + docker-php-ext-install opcache && \ + echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini && \ + echo "opcache.enable_cli=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini + +RUN echo "---> Swoole" && \ + pecl install swoole -D 'enable-http2="yes"' && \ + docker-php-ext-enable swoole + +RUN echo "---> Adding NewRelic" && \ + apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests gnupg2 \ + && echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list \ + && wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add - \ + && sudo apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests newrelic-php5 \ + && NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 newrelic-install install \ + && chown www-data:www-data /usr/local/etc/php/conf.d/newrelic.ini && chmod a+rw /usr/local/etc/php/conf.d/newrelic.ini \ + && apt-get remove -y gnupg2 && rm -rf /var/lib/apt/lists/* \ + && echo "newrelic.distributed_tracing_enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ + && echo "newrelic.application_logging.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ + && echo "newrelic.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini + +RUN echo "---> Adding Tini" && \ + wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \ + chmod +x /tini + +RUN echo "---> Config sudoers" && \ + echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers + +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer +RUN echo "---> Fix permissions" \ + && mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer + +COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf +COPY configs/php-errors.ini /usr/local/etc/php/conf.d/php-errors.ini +COPY ./bin /usr/bin/ + +RUN chmod a+x \ + /usr/bin/swoole-run \ + /usr/bin/xdebug-set-mode \ + /usr/bin/post-startup-hook + +USER www-data + +WORKDIR "/var/www/html" + +EXPOSE 8080 9001 + +CMD ["/tini", "--", "/usr/bin/swoole-run.sh"] diff --git a/bin/swoole-run.sh b/bin/swoole-run.sh new file mode 100644 index 0000000..1ecc0b1 --- /dev/null +++ b/bin/swoole-run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +server-warmup + +exec /usr/local/bin/php ./server.php From 52f85931ffb0f490a9dc9f68d5d48c97ec668204 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Fri, 14 Nov 2025 08:25:14 -0300 Subject: [PATCH 03/11] fix: dont cancel sisters --- .github/workflows/docker-build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index fe98dc6..cd3faab 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -59,6 +59,7 @@ jobs: - push_to_registry strategy: + fail-fast: false matrix: variation: - pgsql From d805d3407c85af12cb5935415e8f48912b51f17c Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Fri, 14 Nov 2025 08:25:26 -0300 Subject: [PATCH 04/11] fix: swoole --- Dockerfile.swoole | 2 +- bin/{swoole-run.sh => swoole-run} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename bin/{swoole-run.sh => swoole-run} (100%) mode change 100644 => 100755 diff --git a/Dockerfile.swoole b/Dockerfile.swoole index 45476e2..ca0549a 100644 --- a/Dockerfile.swoole +++ b/Dockerfile.swoole @@ -99,4 +99,4 @@ WORKDIR "/var/www/html" EXPOSE 8080 9001 -CMD ["/tini", "--", "/usr/bin/swoole-run.sh"] +CMD ["/tini", "--", "/usr/bin/swoole-run"] diff --git a/bin/swoole-run.sh b/bin/swoole-run old mode 100644 new mode 100755 similarity index 100% rename from bin/swoole-run.sh rename to bin/swoole-run From fca35b9e40cf27b9a4ce1fdf1a81f95f39098f49 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Fri, 14 Nov 2025 08:25:39 -0300 Subject: [PATCH 05/11] feat: make build-var --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bb27d58..4c0abd7 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,16 @@ all: build IMAGE=lojassimonetti/php-apache-oci8-composer tag=$(shell git branch | grep \* | cut -d ' ' -f2) TAG=$(shell [[ "$(tag)" == "master" ]] && echo "latest" || echo $(tag)) +FILE=Dockerfile build: - docker build --pull . -t $(IMAGE):$(TAG) + docker build --file $(FILE) --pull . -t $(IMAGE):$(TAG) push: build docker push $(IMAGE):$(TAG) +build-var: + make build TAG=$(TAG)-$(var) FILE=$(FILE).$(var) + +push-var: build-var + docker push $(IMAGE):$(TAG)-$(var) From bb7a06bec8385c2e7ec3dd589ec8ed49be05b374 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Sun, 16 Nov 2025 14:16:00 -0300 Subject: [PATCH 06/11] feat: one branch to rule them all --- .github/workflows/docker-build.yaml | 95 ++++++++++++----- .github/workflows/setup-build.yaml | 49 +++++++++ Dockerfile.grpc | 10 ++ Dockerfile.mongodb | 10 ++ Dockerfile.mongodb-1.21.0 | 10 ++ Dockerfile.pgsql | 107 ++------------------ Dockerfile.swoole => Dockerfile.swoole.tmpl | 38 +++++-- Dockerfile => Dockerfile.tmpl | 44 +++++--- Makefile | 27 ++++- config.json | 80 +++++++++++++++ 10 files changed, 314 insertions(+), 156 deletions(-) create mode 100644 .github/workflows/setup-build.yaml create mode 100644 Dockerfile.grpc create mode 100644 Dockerfile.mongodb create mode 100644 Dockerfile.mongodb-1.21.0 rename Dockerfile.swoole => Dockerfile.swoole.tmpl (80%) rename Dockerfile => Dockerfile.tmpl (76%) create mode 100644 config.json diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index cd3faab..0abeed5 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -1,12 +1,42 @@ -name: Publish Docker image +name: Build & Publish on: - push: - branches: ["master", "php*"] + workflow_call: + inputs: + version: + type: string + required: true + name: + type: string + required: true + template: + type: string + required: false + base: + type: string + required: true + xdebug_version: + type: string + required: true + redis_version: + type: string + required: true + imap_type: + type: string + required: true + imap_version: + type: string + required: true + php_erros_enabled: + type: boolean + required: true + variations: + type: string + required: true jobs: - push_to_registry: - name: Push Docker image to Docker Hub + build: + name: Build Docker image runs-on: ubuntu-latest permissions: @@ -17,6 +47,29 @@ jobs: - name: Check out the repo uses: actions/checkout@v4 + - name: install go-replace + env: + GOREPLACE_VERSION: 22.9.0 + run: | + wget -O /usr/local/bin/go-replace \ + https://github.com/webdevops/go-replace/releases/download/$GOREPLACE_VERSION/go-replace.linux.amd64 + chmod +x /usr/local/bin/go-replace + + - name: build Dockerfile + env: + DOCKER_BUILD_VERSION: ${{ inputs.version }} + DOCKER_BUILD_BASE: ${{ inputs.base }} + DOCKER_BUILD_XDEBUG_VERSION: ${{ inputs.xdebug_version }} + DOCKER_BUILD_REDIS_VERSION: ${{ inputs.redis_version }} + DOCKER_BUILD_IMAP_TYPE: ${{ inputs.imap_type }} + DOCKER_BUILD_IMAP_VERSION: ${{ inputs.imap_version }} + DOCKER_BUILD_PHP_ERRORS_ENABLED: ${{ inputs.php_erros_enabled && '1' || '0' }} + run: | + go-replace --mode=template ./${{ inputs.template }} -o ./Dockerfile + + - name: dump Dockerfile + run: cat Dockerfile + - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -29,40 +82,34 @@ jobs: with: images: lojassimonetti/php-apache-oci8-composer tags: | - type=ref,event=branch,enable=true - type=ref,event=tag,enable=true + type=raw,value=${{ inputs.name }},enable=true - name: Should push? - id: shoudPush + id: shouldPush run: | if [[ ${{ github.event.ref }} = "refs/heads/master" ]]; then echo "match=true" >> $GITHUB_OUTPUT - elif [[ ${{ github.event.ref }} =~ ^refs/heads/php[0-9]dot[0-9]$ ]]; then - echo "match=true" >> $GITHUB_OUTPUT - elif [[ ${{ github.event.ref }} =~ ^refs/heads/php[0-9]dot[0-9]-mongodb$ ]]; then - echo "match=true" >> $GITHUB_OUTPUT fi - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . - push: ${{ steps.shoudPush.outputs.match == 'true' }} + push: ${{ steps.shouldPush.outputs.match == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - push_children: - name: Push children Docker image to Docker Hub + build_variations: + name: Build Docker image variation runs-on: ubuntu-latest needs: - - push_to_registry + - build strategy: fail-fast: false matrix: - variation: - - pgsql + variation: ${{ fromJson(inputs.variations) }} permissions: packages: write @@ -84,15 +131,12 @@ jobs: with: images: lojassimonetti/php-apache-oci8-composer tags: | - type=ref,event=branch,enable=true,suffix=-${{ matrix.variation }} - type=ref,event=tag,enable=true,suffix=-${{ matrix.variation }} + type=raw,value=${{ inputs.name }}-${{ matrix.variation }},enable=true - name: Should push? - id: shoudPush + id: shouldPush run: | - if [[ ${{ github.event.ref }} =~ ^refs/heads/php[0-9]dot[0-9]$ ]]; then - echo "match=true" >> $GITHUB_OUTPUT - elif [[ ${{ github.event.ref }} = "refs/heads/master" ]]; then + if [[ ${{ github.event.ref }} = "refs/heads/master" ]]; then echo "match=true" >> $GITHUB_OUTPUT fi @@ -100,7 +144,8 @@ jobs: uses: docker/build-push-action@v5 with: context: . + build-args: IMAGE_BASE=lojassimonetti/php-apache-oci8-composer:${{ inputs.name }} file: ./Dockerfile.${{ matrix.variation }} - push: ${{ steps.shoudPush.outputs.match == 'true' }} + push: ${{ steps.shouldPush.outputs.match == 'true' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/setup-build.yaml b/.github/workflows/setup-build.yaml new file mode 100644 index 0000000..5d9f5a4 --- /dev/null +++ b/.github/workflows/setup-build.yaml @@ -0,0 +1,49 @@ +name: Publish Docker image + +on: + push: + +jobs: + setup: + name: Setup Matrix Build + runs-on: ubuntu-latest + + permissions: + packages: write + contents: read + + outputs: + versions: ${{ steps.read.outputs.versions }} + + steps: + - name: Check out the repo + uses: actions/checkout@v5 + + - name: read configs + id: read + run: | + echo "versions=$(cat config.json | jq . --compact-output)" >> "$GITHUB_OUTPUT" + + docker_build_push: + name: Build and Push + needs: + - setup + + strategy: + fail-fast: false + matrix: + config: ${{ fromJson(needs.setup.outputs.versions) }} + + uses: ./.github/workflows/docker-build.yaml + secrets: inherit + with: + name: ${{ matrix.config.name }} + base: ${{ matrix.config.base }} + template: ${{ matrix.config.template || 'Dockerfile.tmpl' }} + version: ${{ matrix.config.version }} + xdebug_version: ${{ matrix.config.xdebug_version }} + redis_version: ${{ matrix.config.redis_version }} + imap_version: ${{ matrix.config.imap_version }} + imap_type: ${{ matrix.config.imap_type }} + php_erros_enabled: ${{ matrix.config.php_erros_enabled }} + variations: ${{ toJson(matrix.config.variations) }} diff --git a/Dockerfile.grpc b/Dockerfile.grpc new file mode 100644 index 0000000..55003ba --- /dev/null +++ b/Dockerfile.grpc @@ -0,0 +1,10 @@ +ARG IMAGE_BASE +FROM ${IMAGE_BASE} + +USER root + +RUN echo "---> GRPC" && \ + pecl install grpc && \ + docker-php-ext-enable grpc + +USER www-data:www-data diff --git a/Dockerfile.mongodb b/Dockerfile.mongodb new file mode 100644 index 0000000..bff1a2e --- /dev/null +++ b/Dockerfile.mongodb @@ -0,0 +1,10 @@ +ARG IMAGE_BASE +FROM ${IMAGE_BASE} + +USER root + +RUN echo "---> Mongo DB" && \ + pecl install mongodb && \ + docker-php-ext-enable mongodb + +USER www-data:www-data diff --git a/Dockerfile.mongodb-1.21.0 b/Dockerfile.mongodb-1.21.0 new file mode 100644 index 0000000..d70b958 --- /dev/null +++ b/Dockerfile.mongodb-1.21.0 @@ -0,0 +1,10 @@ +ARG IMAGE_BASE +FROM ${IMAGE_BASE} + +USER root + +RUN echo "---> Mongo DB" && \ + pecl install mongodb-1.21.0 && \ + docker-php-ext-enable mongodb + +USER www-data:www-data diff --git a/Dockerfile.pgsql b/Dockerfile.pgsql index d7fee14..c576bdf 100644 --- a/Dockerfile.pgsql +++ b/Dockerfile.pgsql @@ -1,103 +1,10 @@ -# Container Base -FROM php:7.4-apache +ARG IMAGE_BASE +FROM ${IMAGE_BASE} -ENV http_proxy=${HTTP_PROXY} -ENV https_proxy=${HTTP_PROXY} -ENV NR_ENABLED=false -ENV NR_DISTRIBUTED_TRACING_ENABLED=false -ENV NR_APPLICATION_LOGGING_ENABLED=false -ENV NR_IGNORE_DEFAULT_EXCEPTION=false -ENV NR_IGNORED_EXECEPTIONS="" -ENV NR_APP_NAME="" -ENV NR_LICENSE_KEY="" -ENV NR_VERSION="" -ENV PHP_BUILD_DATE="20190902" -ENV PHP_OPCACHE_ENABLED=false -ENV SESSION_HANDLER=false -ENV SESSION_HANDLER_NAME="" -ENV SESSION_HANDLER_PATH="" -ENV XDEBUG_AUTOSTART=false -ENV XDEBUG_CONNECT_BACK=true -ENV XDEBUG_ENABLED=false -ENV XDEBUG_IDEKEY="docker" -ENV XDEBUG_VERSION="-3.1.6" -ENV XDEBUG_REMOTE_PORT=9000 -ENV PHP_EXTENSION_WDDX=1 -ENV PHP_OPENSSL=1 +USER root -ENV CONTAINER_STARTED_LOCK=/var/lock/container.starting +RUN echo "---> PGSQL" && \ + apt-get update && apt-get install -y --no-install-recommends libpq-dev && \ + docker-php-ext-install pdo_pgsql -RUN apt-get update && apt-get install -y --no-install-recommends wget vim supervisor libfreetype6-dev libjpeg-dev libjpeg62-turbo-dev \ - libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \ - libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev libpq-dev \ - sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev && \ - rm -rf /var/lib/apt/lists/* - -RUN a2enmod rewrite unique_id headers - -RUN docker-php-ext-configure gd --with-jpeg \ - && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ - && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ - && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql pdo_pgsql calendar exif gettext shmop soap sockets intl pcntl xsl ldap imap - -RUN echo "---> Adding Redis" && \ - pecl install redis && \ - docker-php-ext-enable redis - -RUN echo "---> Adding xDebug" && \ - pecl install "xdebug${XDEBUG_VERSION}" - -RUN echo "---> Adding Zip" && \ - pecl install zip && \ - docker-php-ext-enable zip - -RUN echo "---> Adding AMQP" && \ - pecl install amqp && \ - docker-php-ext-enable amqp - -RUN echo "---> Configure Opcache" && \ - docker-php-ext-install opcache && \ - echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini && \ - echo "opcache.enable_cli=0" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini - -RUN apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests gnupg2 \ - && echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list \ - && wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add - \ - && sudo apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests newrelic-php5 \ - && NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 newrelic-install install \ - && chown www-data:www-data /usr/local/etc/php/conf.d/newrelic.ini && chmod a+rw /usr/local/etc/php/conf.d/newrelic.ini \ - && apt-get remove -y gnupg2 && rm -rf /var/lib/apt/lists/* \ - && echo "newrelic.distributed_tracing_enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ - && echo "newrelic.application_logging.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ - && echo "newrelic.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini - -RUN echo "---> Adding Tini" && \ - wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \ - chmod +x /tini - -RUN echo "---> Config sudoers" && \ - echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers - -RUN echo "---> Fix Logs permissions" && \ - chown -R www-data:www-data /var/log/apache2 - -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer && \ - mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer - -COPY configs/ports.conf /etc/apache2/ports.conf -COPY configs/headers.conf /etc/apache2/conf-enabled/headers.conf -COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf -COPY apache-run.sh /usr/bin/apache-run -COPY ./bin /usr/bin/ - -RUN chmod a+x \ - /usr/bin/apache-run \ - /usr/bin/post-startup-hook - -USER www-data - -WORKDIR "/var/www/html" - -EXPOSE 8080 9001 - -CMD ["/tini", "--", "/usr/bin/apache-run"] +USER www-data:www-data diff --git a/Dockerfile.swoole b/Dockerfile.swoole.tmpl similarity index 80% rename from Dockerfile.swoole rename to Dockerfile.swoole.tmpl index ca0549a..fc1cf79 100644 --- a/Dockerfile.swoole +++ b/Dockerfile.swoole.tmpl @@ -1,12 +1,11 @@ -# Container Base -FROM php:8.3-apache-bookworm +{{ $version := float64 (env "DOCKER_BUILD_VERSION") -}} +FROM {{ env "DOCKER_BUILD_BASE" }} ENV \ NR_ENABLED=false \ NR_APP_NAME="" \ NR_LICENSE_KEY="" \ NR_VERSION="" \ - PHP_BUILD_DATE="20211130" \ PHP_OPCACHE_ENABLED=false \ SESSION_HANDLER=false \ SESSION_HANDLER_NAME="" \ @@ -15,8 +14,15 @@ ENV \ XDEBUG_CONNECT_BACK=true \ XDEBUG_ENABLED=false \ XDEBUG_IDEKEY="docker" \ - XDEBUG_VERSION="-3.3.2" \ - REDIS_VERSION="-5.3.7" \ + XDEBUG_VERSION="{{ if not (eq (env "DOCKER_BUILD_XDEBUG_VERSION") "") -}} + -{{ env "DOCKER_BUILD_XDEBUG_VERSION" }} + {{- end }}" \ + REDIS_VERSION="{{ if not (eq (env "DOCKER_BUILD_REDIS_VERSION") "") -}} + -{{ env "DOCKER_BUILD_REDIS_VERSION" }} + {{- end }}" \ + IMAP_VERSION="{{ if not (eq (env "DOCKER_BUILD_IMAP_VERSION") "") -}} + -{{ env "DOCKER_BUILD_IMAP_VERSION" }} + {{- end }}" \ XDEBUG_REMOTE_PORT=9000 \ PHP_EXTENSION_WDDX=1 \ PHP_OPENSSL=1 \ @@ -25,13 +31,21 @@ ENV \ RUN apt-get update && apt-get install -y --no-install-recommends wget vim supervisor libfreetype6-dev libjpeg-dev libjpeg62-turbo-dev \ libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \ libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev \ - sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev musl-dev && \ + sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev{{ if gt $version 7.4 }} musl-dev{{end}} && \ rm -rf /var/lib/apt/lists/* RUN docker-php-ext-configure gd --with-jpeg \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ +{{- if eq (env "DOCKER_BUILD_IMAP_TYPE") "php-ext" }} && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ - && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap imap ftp +{{- end }} + && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap ftp{{ if eq (env "DOCKER_BUILD_IMAP_TYPE") "php-ext" }} imap{{end}} +{{- if eq (env "DOCKER_BUILD_IMAP_TYPE") "pecl" }} + +RUN echo "---> Adding IMAP" && \ + pecl install imap${IMAP_VERSION} && \ + docker-php-ext-enable imap +{{ end }} RUN echo "---> Adding Redis" && \ pecl install redis${REDIS_VERSION} && \ @@ -61,6 +75,10 @@ RUN echo "---> Swoole" && \ pecl install swoole -D 'enable-http2="yes"' && \ docker-php-ext-enable swoole +RUN echo "---> Adding Tini" && \ + wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \ + chmod +x /tini + RUN echo "---> Adding NewRelic" && \ apt-get update && apt-get install -y -q --no-install-recommends --no-install-suggests gnupg2 \ && echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | sudo tee /etc/apt/sources.list.d/newrelic.list \ @@ -73,10 +91,6 @@ RUN echo "---> Adding NewRelic" && \ && echo "newrelic.application_logging.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ && echo "newrelic.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini -RUN echo "---> Adding Tini" && \ - wget -O /tini https://github.com/krallin/tini/releases/download/v0.18.0/tini-static && \ - chmod +x /tini - RUN echo "---> Config sudoers" && \ echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers @@ -85,7 +99,9 @@ RUN echo "---> Fix permissions" \ && mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf +{{- if eq (env "DOCKER_BUILD_PHP_ERRORS_ENABLED") "1" }} COPY configs/php-errors.ini /usr/local/etc/php/conf.d/php-errors.ini +{{ end }} COPY ./bin /usr/bin/ RUN chmod a+x \ diff --git a/Dockerfile b/Dockerfile.tmpl similarity index 76% rename from Dockerfile rename to Dockerfile.tmpl index 0a66e12..f1e79d2 100644 --- a/Dockerfile +++ b/Dockerfile.tmpl @@ -1,13 +1,15 @@ -# Container Base -FROM php:8.4-apache-bookworm +{{ $version := float64 (env "DOCKER_BUILD_VERSION") -}} +FROM {{ env "DOCKER_BUILD_BASE" }} ENV \ NR_ENABLED=false \ + NR_DISTRIBUTED_TRACING_ENABLED=false \ + NR_APPLICATION_LOGGING_ENABLED=false \ + NR_IGNORE_DEFAULT_EXCEPTION=false \ + NR_IGNORED_EXECEPTIONS="" \ NR_APP_NAME="" \ NR_LICENSE_KEY="" \ NR_VERSION="" \ - NR_IGNORE_DEFAULT_EXCEPTION=false \ - NR_IGNORED_EXECEPTIONS="" \ PHP_OPCACHE_ENABLED=false \ SESSION_HANDLER=false \ SESSION_HANDLER_NAME="" \ @@ -16,9 +18,15 @@ ENV \ XDEBUG_CONNECT_BACK=true \ XDEBUG_ENABLED=false \ XDEBUG_IDEKEY="docker" \ - XDEBUG_VERSION="-3.4.1" \ - REDIS_VERSION="-6.1.0" \ - IMAP_VERSION="" \ + XDEBUG_VERSION="{{ if not (eq (env "DOCKER_BUILD_XDEBUG_VERSION") "") -}} + -{{ env "DOCKER_BUILD_XDEBUG_VERSION" }} + {{- end }}" \ + REDIS_VERSION="{{ if not (eq (env "DOCKER_BUILD_REDIS_VERSION") "") -}} + -{{ env "DOCKER_BUILD_REDIS_VERSION" }} + {{- end }}" \ + IMAP_VERSION="{{ if not (eq (env "DOCKER_BUILD_IMAP_VERSION") "") -}} + -{{ env "DOCKER_BUILD_IMAP_VERSION" }} + {{- end }}" \ XDEBUG_REMOTE_PORT=9000 \ PHP_EXTENSION_WDDX=1 \ PHP_OPENSSL=1 \ @@ -27,18 +35,23 @@ ENV \ RUN apt-get update && apt-get install -y --no-install-recommends wget vim supervisor libfreetype6-dev libjpeg-dev libjpeg62-turbo-dev \ libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \ libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev \ - sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev musl-dev && \ + sudo zlib1g zlib1g-dev libzip4 libzip-dev zip unzip librabbitmq-dev{{ if gt $version 7.4 }} musl-dev{{end}} && \ rm -rf /var/lib/apt/lists/* RUN a2enmod rewrite unique_id headers RUN docker-php-ext-configure gd --with-jpeg \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ - && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap ftp +{{- if eq (env "DOCKER_BUILD_IMAP_TYPE") "php-ext" }} + && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \ +{{- end }} + && docker-php-ext-install -j$(nproc) bcmath gd pdo_mysql calendar exif gettext shmop soap sockets intl pcntl xsl ldap ftp{{ if eq (env "DOCKER_BUILD_IMAP_TYPE") "php-ext" }} imap{{end}} +{{- if eq (env "DOCKER_BUILD_IMAP_TYPE") "pecl" }} RUN echo "---> Adding IMAP" && \ pecl install imap${IMAP_VERSION} && \ docker-php-ext-enable imap +{{ end }} RUN echo "---> Adding Redis" && \ pecl install redis${REDIS_VERSION} && \ @@ -52,12 +65,8 @@ RUN echo "---> Adding Zip" && \ docker-php-ext-enable zip RUN echo "---> Adding AMQp" && \ - apt-get update && apt-get install -y -f librabbitmq-dev libssh-dev \ - && docker-php-source extract \ - && mkdir /usr/src/php/ext/amqp \ - && curl -L https://github.com/php-amqp/php-amqp/archive/master.tar.gz | tar -xzC /usr/src/php/ext/amqp --strip-components=1 \ - && docker-php-ext-install amqp \ - && docker-php-ext-enable amqp + pecl install amqp && \ + docker-php-ext-enable amqp RUN echo "---> Configure Opcache" && \ docker-php-ext-install opcache && \ @@ -76,7 +85,7 @@ RUN echo "---> Adding NewRelic" && \ && NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 newrelic-install install \ && cp /usr/lib/newrelic-php5/scripts/newrelic.ini.template /usr/local/etc/php/conf.d/newrelic.ini \ && chown www-data:www-data /usr/local/etc/php/conf.d/newrelic.ini && chmod a+rw /usr/local/etc/php/conf.d/newrelic.ini \ - && apt-get remove -y gnupg2 && rm -rf /var/lib/apt/lists/* #\ + && apt-get remove -y gnupg2 && rm -rf /var/lib/apt/lists/* \ && echo "newrelic.distributed_tracing_enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ && echo "newrelic.application_logging.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini \ && echo "newrelic.enabled = false" | sudo tee -a /usr/local/etc/php/conf.d/newrelic.ini @@ -85,6 +94,7 @@ RUN echo "---> Config sudoers" && \ echo "www-data ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + RUN echo "---> Fix permissions" \ && chown -R www-data:www-data /var/log/apache2 \ && mkdir /var/www/.composer && chown -R www-data:www-data /var/www/.composer @@ -92,7 +102,9 @@ RUN echo "---> Fix permissions" \ COPY configs/ports.conf /etc/apache2/ports.conf COPY configs/headers.conf /etc/apache2/conf-enabled/headers.conf COPY configs/logs.conf /etc/apache2/conf-enabled/logs.conf +{{- if eq (env "DOCKER_BUILD_PHP_ERRORS_ENABLED") "1" }} COPY configs/php-errors.ini /usr/local/etc/php/conf.d/php-errors.ini +{{ end }} COPY apache-run.sh /usr/bin/apache-run COPY ./bin /usr/bin/ diff --git a/Makefile b/Makefile index 4c0abd7..99f2740 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,37 @@ all: build IMAGE=lojassimonetti/php-apache-oci8-composer -tag=$(shell git branch | grep \* | cut -d ' ' -f2) -TAG=$(shell [[ "$(tag)" == "master" ]] && echo "latest" || echo $(tag)) FILE=Dockerfile +list-names: + @cat config.json|jq '.[]|.name' --raw-output + build: - docker build --file $(FILE) --pull . -t $(IMAGE):$(TAG) +ifndef name + $(error No name was informed throught the "name" parameter) +endif + docker run --rm \ + `cat config.json | \ + jq '.[]|select(.name == "$(name)")|to_entries|map(select(.key != "variations"))' | \ + jq '.|map(" -e DOCKER_BUILD_" + (.key|ascii_upcase) + "=" + (.value|tostring) + "")|.[]' \ + --raw-output` \ + -v `pwd`:/work -w /work \ + webdevops/go-replace:latest \ + --mode=template ./`cat config.json | \ + jq '.[]|select(.name == "$(name)")|.template|if . == null then "Dockerfile.tmpl" else . end' --raw-output` \ + -o Dockerfile + docker build . --pull -t $(IMAGE):$(name) + rm Dockerfile push: build docker push $(IMAGE):$(TAG) build-var: - make build TAG=$(TAG)-$(var) FILE=$(FILE).$(var) +ifndef name + $(error No variation was informed throught the "var" parameter) +endif + make build name=$(name) + docker build --build-arg IMAGE_BASE=$(IMAGE):$(name) --file Dockerfile.$(var) -t $(IMAGE):$(name)-$(var) . push-var: build-var docker push $(IMAGE):$(TAG)-$(var) diff --git a/config.json b/config.json new file mode 100644 index 0000000..db205c3 --- /dev/null +++ b/config.json @@ -0,0 +1,80 @@ +[ + { + "name": "php7dot4", + "version": "7.4", + "base": "php:7.4-apache", + "xdebug_version": "3.1.6", + "redis_version": "5.3.7", + "imap_version": "", + "imap_type": "php-ext", + "php_erros_enabled": false, + "variations": ["pgsql"] + }, + { + "name": "php8dot0", + "version": "8.0", + "base": "php:8.0-apache", + "xdebug_version": "3.2.1", + "redis_version": "5.3.7", + "imap_version": "", + "imap_type": "php-ext", + "php_erros_enabled": true, + "variations": [] + }, + { + "name": "php8dot1", + "version": "8.1", + "base": "php:8.1-apache-bookworm", + "xdebug_version": "3.2.1", + "redis_version": "5.3.7", + "imap_version": "", + "imap_type": "php-ext", + "php_erros_enabled": true, + "variations": [] + }, + { + "name": "php8dot2", + "version": "8.2", + "base": "php:8.2-apache-bookworm", + "xdebug_version": "3.2.1", + "redis_version": "5.3.7", + "imap_version": "", + "imap_type": "php-ext", + "php_erros_enabled": true, + "variations": [] + }, + { + "name": "php8dot3", + "version": "8.3", + "base": "php:8.3-apache-bookworm", + "xdebug_version": "3.3.2", + "redis_version": "5.3.7", + "imap_version": "", + "imap_type": "php-ext", + "php_erros_enabled": true, + "variations": ["grpc", "mongodb", "mongodb-1.21.0"] + }, + { + "name": "php8dot3-swoole", + "version": "8.3", + "base": "php:8.3-bookworm", + "template": "Dockerfile.swoole.tmpl", + "xdebug_version": "3.3.2", + "redis_version": "5.3.7", + "imap_version": "", + "imap_type": "php-ext", + "php_erros_enabled": true, + "variations": ["grpc"] + }, + { + "name": "php8dot4", + "version": "8.4", + "base": "php:8.4-apache-bookworm", + "xdebug_version": "3.4.1", + "redis_version": "6.1.0", + "imap_version": "", + "imap_type": "pecl", + "php_erros_enabled": true, + "variations": ["grpc", "mongodb"] + } +] From c2c9a73302dd82b40b6fd2f45b74b0b41d0b7a66 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Sun, 16 Nov 2025 16:11:20 -0300 Subject: [PATCH 07/11] feat: not used --- config.json | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/config.json b/config.json index db205c3..cea74e9 100644 --- a/config.json +++ b/config.json @@ -10,28 +10,6 @@ "php_erros_enabled": false, "variations": ["pgsql"] }, - { - "name": "php8dot0", - "version": "8.0", - "base": "php:8.0-apache", - "xdebug_version": "3.2.1", - "redis_version": "5.3.7", - "imap_version": "", - "imap_type": "php-ext", - "php_erros_enabled": true, - "variations": [] - }, - { - "name": "php8dot1", - "version": "8.1", - "base": "php:8.1-apache-bookworm", - "xdebug_version": "3.2.1", - "redis_version": "5.3.7", - "imap_version": "", - "imap_type": "php-ext", - "php_erros_enabled": true, - "variations": [] - }, { "name": "php8dot2", "version": "8.2", From 0fa9d281fb8c92ddf104ab4f79ad38659b55e59d Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Sun, 16 Nov 2025 16:56:29 -0300 Subject: [PATCH 08/11] feat: only push on default branch --- .github/workflows/docker-build.yaml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 0abeed5..f122968 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -33,6 +33,9 @@ on: variations: type: string required: true + push: + type: boolean + default: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} jobs: build: @@ -84,18 +87,11 @@ jobs: tags: | type=raw,value=${{ inputs.name }},enable=true - - name: Should push? - id: shouldPush - run: | - if [[ ${{ github.event.ref }} = "refs/heads/master" ]]; then - echo "match=true" >> $GITHUB_OUTPUT - fi - - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . - push: ${{ steps.shouldPush.outputs.match == 'true' }} + push: ${{ inputs.push }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} @@ -133,19 +129,12 @@ jobs: tags: | type=raw,value=${{ inputs.name }}-${{ matrix.variation }},enable=true - - name: Should push? - id: shouldPush - run: | - if [[ ${{ github.event.ref }} = "refs/heads/master" ]]; then - echo "match=true" >> $GITHUB_OUTPUT - fi - - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . build-args: IMAGE_BASE=lojassimonetti/php-apache-oci8-composer:${{ inputs.name }} file: ./Dockerfile.${{ matrix.variation }} - push: ${{ steps.shouldPush.outputs.match == 'true' }} + push: ${{ inputs.push }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 1ce4483b0ad0efba35a771c210048e01dee9ddfe Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Sun, 16 Nov 2025 17:06:03 -0300 Subject: [PATCH 09/11] chore: shorter name --- .github/workflows/docker-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index f122968..66dfcb4 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -96,7 +96,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build_variations: - name: Build Docker image variation + name: Build image variation runs-on: ubuntu-latest needs: From c5a835cef9ed343f1c8b8586391b1e55485b74d7 Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Sun, 16 Nov 2025 17:16:39 -0300 Subject: [PATCH 10/11] fix: erro{,r}s --- .github/workflows/docker-build.yaml | 4 ++-- .github/workflows/setup-build.yaml | 2 +- config.json | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 66dfcb4..49c1b81 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -27,7 +27,7 @@ on: imap_version: type: string required: true - php_erros_enabled: + php_errors_enabled: type: boolean required: true variations: @@ -66,7 +66,7 @@ jobs: DOCKER_BUILD_REDIS_VERSION: ${{ inputs.redis_version }} DOCKER_BUILD_IMAP_TYPE: ${{ inputs.imap_type }} DOCKER_BUILD_IMAP_VERSION: ${{ inputs.imap_version }} - DOCKER_BUILD_PHP_ERRORS_ENABLED: ${{ inputs.php_erros_enabled && '1' || '0' }} + DOCKER_BUILD_PHP_ERRORS_ENABLED: ${{ inputs.php_errors_enabled && '1' || '0' }} run: | go-replace --mode=template ./${{ inputs.template }} -o ./Dockerfile diff --git a/.github/workflows/setup-build.yaml b/.github/workflows/setup-build.yaml index 5d9f5a4..595b015 100644 --- a/.github/workflows/setup-build.yaml +++ b/.github/workflows/setup-build.yaml @@ -45,5 +45,5 @@ jobs: redis_version: ${{ matrix.config.redis_version }} imap_version: ${{ matrix.config.imap_version }} imap_type: ${{ matrix.config.imap_type }} - php_erros_enabled: ${{ matrix.config.php_erros_enabled }} + php_errors_enabled: ${{ matrix.config.php_errors_enabled }} variations: ${{ toJson(matrix.config.variations) }} diff --git a/config.json b/config.json index cea74e9..d46273c 100644 --- a/config.json +++ b/config.json @@ -7,7 +7,7 @@ "redis_version": "5.3.7", "imap_version": "", "imap_type": "php-ext", - "php_erros_enabled": false, + "php_errors_enabled": false, "variations": ["pgsql"] }, { @@ -18,7 +18,7 @@ "redis_version": "5.3.7", "imap_version": "", "imap_type": "php-ext", - "php_erros_enabled": true, + "php_errors_enabled": true, "variations": [] }, { @@ -29,7 +29,7 @@ "redis_version": "5.3.7", "imap_version": "", "imap_type": "php-ext", - "php_erros_enabled": true, + "php_errors_enabled": true, "variations": ["grpc", "mongodb", "mongodb-1.21.0"] }, { @@ -41,7 +41,7 @@ "redis_version": "5.3.7", "imap_version": "", "imap_type": "php-ext", - "php_erros_enabled": true, + "php_errors_enabled": true, "variations": ["grpc"] }, { @@ -52,7 +52,7 @@ "redis_version": "6.1.0", "imap_version": "", "imap_type": "pecl", - "php_erros_enabled": true, + "php_errors_enabled": true, "variations": ["grpc", "mongodb"] } ] From fc1fda88d84ddd305bf87258198a6a467046d58e Mon Sep 17 00:00:00 2001 From: Lucas dos Santos Abreu Date: Mon, 17 Nov 2025 14:36:36 -0300 Subject: [PATCH 11/11] feat: add dockerfiles to summary --- .github/workflows/docker-build.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 49c1b81..6c8cdb1 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -70,8 +70,12 @@ jobs: run: | go-replace --mode=template ./${{ inputs.template }} -o ./Dockerfile - - name: dump Dockerfile - run: cat Dockerfile + - name: add Dockerfile to summary + run: | + echo '### Dockerfile generated for ${{ inputs.name }}' >> $GITHUB_STEP_SUMMARY + echo '```dockerfile' >> $GITHUB_STEP_SUMMARY + cat Dockerfile >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY - name: Log in to Docker Hub uses: docker/login-action@v3