From e4ec5699af15d84be1c486714344c00bf18ce615 Mon Sep 17 00:00:00 2001 From: Chris Snyder Date: Thu, 4 Jun 2026 12:05:04 +1200 Subject: [PATCH] feat: Removed xdebug from normal PHP 8.4 and 8.5 containers, bumped xdebug versions to latest patch release to fix segfault issue --- .github/workflows/build-image.yml | 14 +++++++++++++ .github/workflows/build-php-debug.yml | 30 +++++++++++++++++++++++++++ .github/workflows/build-php.yml | 2 +- compose/build.yml | 4 ++-- compose/php.yml | 14 ++++++------- php/php84/Dockerfile | 5 ----- php/php84/Dockerfile-debug | 6 ++++++ php/php85/Dockerfile | 7 +------ php/php85/Dockerfile-debug | 6 ++++++ 9 files changed, 67 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/build-php-debug.yml create mode 100644 php/php84/Dockerfile-debug create mode 100644 php/php85/Dockerfile-debug diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 770390fc..f5708d44 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -19,6 +19,10 @@ on: required: false type: boolean default: false + debug: + required: false + type: boolean + default: false jobs: build-image: @@ -59,3 +63,13 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} push: ${{ inputs.push }} + - name: Build and push debug image + if: ${{ inputs.debug == true }} + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 + with: + context: ${{ inputs.context }} + file: ${{ inputs.context }}/${{ inputs.dockerfile }}-debug + platforms: ${{ inputs.multiarch == true && 'linux/amd64,linux/arm64' || 'linux/amd64' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: ${{ inputs.push }} diff --git a/.github/workflows/build-php-debug.yml b/.github/workflows/build-php-debug.yml new file mode 100644 index 00000000..7070a991 --- /dev/null +++ b/.github/workflows/build-php-debug.yml @@ -0,0 +1,30 @@ +name: Build PHP + xdebug images + +on: + release: + types: + - created + pull_request: + branches: + - master + paths: + - php/** + - '!php/includes/**' + - .github/workflows/build-image.yml + - .github/workflows/build-php.yml + +jobs: + build-php-images: + name: Build PHP + xdebug images + uses: ./.github/workflows/build-image.yml + strategy: + fail-fast: false + matrix: + version: [84, 85] + with: + image: php${{ matrix.version }} + context: ./php + dockerfile: php${{ matrix.version }}/Dockerfile + push: ${{ github.event_name == 'release' }} + debug: true + secrets: inherit diff --git a/.github/workflows/build-php.yml b/.github/workflows/build-php.yml index 15dde53d..43a4eed1 100644 --- a/.github/workflows/build-php.yml +++ b/.github/workflows/build-php.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - version: [73, 74, 80, 81, 82, 83, 84, 85] + version: [73, 74, 80, 81, 82, 83] with: image: php${{ matrix.version }} context: ./php diff --git a/compose/build.yml b/compose/build.yml index 5fce695e..6a82b2d2 100644 --- a/compose/build.yml +++ b/compose/build.yml @@ -108,7 +108,7 @@ services: php-8.4-debug: build: context: ./php - dockerfile: php84/Dockerfile + dockerfile: php84/Dockerfile-debug args: TIME_ZONE: ${TIME_ZONE} @@ -122,7 +122,7 @@ services: php-8.5-debug: build: context: ./php - dockerfile: php85/Dockerfile + dockerfile: php85/Dockerfile-debug args: TIME_ZONE: ${TIME_ZONE} diff --git a/compose/php.yml b/compose/php.yml index 36e1136e..137d0138 100644 --- a/compose/php.yml +++ b/compose/php.yml @@ -338,13 +338,11 @@ services: - bash-history:/root/.bash_history - zsh-history:/root/.zsh_history - ./shell:/root/custom_shell - depends_on: - - php-8.4-debug networks: - totara php-8.4-debug: - image: ghcr.io/totara/docker-dev-php84 + image: ghcr.io/totara/docker-dev-php84-debug container_name: totara_php84_debug working_dir: ${REMOTE_SRC} environment: @@ -369,6 +367,8 @@ services: - ./shell:/root/custom_shell networks: - totara + depends_on: + - php-8.4 php-8.5: image: ghcr.io/totara/docker-dev-php85 @@ -389,13 +389,11 @@ services: - bash-history:/root/.bash_history - zsh-history:/root/.zsh_history - ./shell:/root/custom_shell - depends_on: - - php-8.5-debug networks: - - totara + - totara php-8.5-debug: - image: ghcr.io/totara/docker-dev-php85 + image: ghcr.io/totara/docker-dev-php85-debug container_name: totara_php85_debug working_dir: ${REMOTE_SRC} environment: @@ -420,6 +418,8 @@ services: - ./shell:/root/custom_shell networks: - totara + depends_on: + - php-8.5 # php-X.X: ... # php-X.X-debug: ... diff --git a/php/php84/Dockerfile b/php/php84/Dockerfile index 7b8a0230..52480ffd 100644 --- a/php/php84/Dockerfile +++ b/php/php84/Dockerfile @@ -95,11 +95,6 @@ RUN pecl channel-update pecl.php.net && \ && rm -rf /tmp/pear \ && docker-php-ext-enable pspell -RUN pecl channel-update pecl.php.net && \ - pecl install -o -f xdebug-3.4.0 \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable xdebug.so - RUN pecl channel-update pecl.php.net && \ pecl install -o -f pcov \ && rm -rf /tmp/pear \ diff --git a/php/php84/Dockerfile-debug b/php/php84/Dockerfile-debug new file mode 100644 index 00000000..52b4b9d1 --- /dev/null +++ b/php/php84/Dockerfile-debug @@ -0,0 +1,6 @@ +FROM ghcr.io/totara/docker-dev-php84 + +RUN pecl channel-update pecl.php.net && \ + pecl install -o -f xdebug-3.4.7 \ + && rm -rf /tmp/pear \ + && docker-php-ext-enable xdebug.so diff --git a/php/php85/Dockerfile b/php/php85/Dockerfile index b02961c7..6e929713 100644 --- a/php/php85/Dockerfile +++ b/php/php85/Dockerfile @@ -37,7 +37,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ libpspell-dev \ xmlstarlet \ libtool \ - bison + bison COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie @@ -99,11 +99,6 @@ RUN pecl channel-update pecl.php.net && \ && rm -rf /tmp/pear \ && docker-php-ext-enable pspell -RUN pecl channel-update pecl.php.net && \ - pecl install -o -f xdebug-3.5.0 \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable xdebug.so - RUN pecl channel-update pecl.php.net && \ pecl install -o -f pcov \ && rm -rf /tmp/pear \ diff --git a/php/php85/Dockerfile-debug b/php/php85/Dockerfile-debug new file mode 100644 index 00000000..ee0c885b --- /dev/null +++ b/php/php85/Dockerfile-debug @@ -0,0 +1,6 @@ +FROM ghcr.io/totara/docker-dev-php85 + +RUN pecl channel-update pecl.php.net && \ + pecl install -o -f xdebug-3.5.1 \ + && rm -rf /tmp/pear \ + && docker-php-ext-enable xdebug.so