Skip to content

Commit 5992dd9

Browse files
committed
fix(docker): Downgrade PHP from 8.5 to 8.3 and add PR CI check
PHP 8.5 is not officially released and causes docker-php-ext-install to fail with "cp: can't stat 'modules/*'" error. Changes: - Revert to PHP 8.3-fpm-alpine (current stable LTS) - Add pull_request trigger to docker-build workflow - Use dorny/paths-filter to skip build when no Docker files changed - Workflow can now be set as a required check (always runs, skips gracefully)
1 parent cd5fc2c commit 5992dd9

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# Triggers on:
44
# - Push to main branch affecting docker/* or drupal/* files
5+
# - All pull requests (skips build if no relevant files changed)
56
# - Manual workflow_dispatch
67
#
78
# Produces:
@@ -12,12 +13,13 @@ name: Build LocalGov Drupal Container
1213

1314
on:
1415
push:
15-
branches: [main, fix/menu-links-search-index]
16+
branches: [main]
1617
paths:
1718
- 'cloudformation/scenarios/localgov-drupal/docker/**'
1819
- 'cloudformation/scenarios/localgov-drupal/drupal/**'
1920
- 'cloudformation/scenarios/localgov-drupal/.dockerignore'
2021
- '.github/workflows/docker-build.yml'
22+
pull_request:
2123
workflow_dispatch:
2224
inputs:
2325
push_image:
@@ -31,9 +33,32 @@ env:
3133
IMAGE_NAME: co-cddo/ndx_try_aws_scenarios-localgov_drupal
3234

3335
jobs:
36+
changes:
37+
name: Check for Docker changes
38+
runs-on: ubuntu-latest
39+
if: github.event_name == 'pull_request'
40+
outputs:
41+
docker: ${{ steps.filter.outputs.docker }}
42+
steps:
43+
- uses: actions/checkout@v6
44+
- uses: dorny/paths-filter@v3
45+
id: filter
46+
with:
47+
filters: |
48+
docker:
49+
- 'cloudformation/scenarios/localgov-drupal/docker/**'
50+
- 'cloudformation/scenarios/localgov-drupal/drupal/**'
51+
- 'cloudformation/scenarios/localgov-drupal/.dockerignore'
52+
- '.github/workflows/docker-build.yml'
53+
3454
build:
3555
name: Build and Push Container
3656
runs-on: ubuntu-latest
57+
needs: [changes]
58+
# Run if: push/dispatch (changes job skipped), OR PR with docker changes
59+
if: |
60+
always() &&
61+
(needs.changes.result == 'skipped' || needs.changes.outputs.docker == 'true')
3762
permissions:
3863
contents: read
3964
packages: write

cloudformation/scenarios/localgov-drupal/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# =============================================================================
88
# Stage 1: Builder - Install Composer dependencies
99
# =============================================================================
10-
FROM php:8.5-fpm-alpine AS builder
10+
FROM php:8.3-fpm-alpine AS builder
1111

1212
# Install build dependencies
1313
RUN apk add --no-cache \
@@ -62,7 +62,7 @@ RUN mkdir -p /var/www/drupal/web/libraries/dropzone \
6262
# =============================================================================
6363
# Stage 2: Runtime - Minimal production image
6464
# =============================================================================
65-
FROM php:8.5-fpm-alpine AS runtime
65+
FROM php:8.3-fpm-alpine AS runtime
6666

6767
# Install runtime dependencies
6868
RUN apk add --no-cache \

0 commit comments

Comments
 (0)