diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 109e51b0..c6056714 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -27,6 +27,11 @@ jobs: matrix: images: ${{ fromJson(vars.IMAGES) }} steps: + - name: Get PR branch + if: github.event.issue.pull_request + id: pr-branch + uses: xt0rted/pull-request-comment-branch@v3 + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -42,7 +47,7 @@ jobs: - uses: actions/checkout@v4 if: ( github.event.issue.pull_request && contains(github.event.comment.body, '/build') ) with: - ref: refs/pull/${{ github.event.issue.number }}/head + ref: ${{ steps.pr-branch.outputs.head_ref }} - name: Login to registry ${{ env.REGISTRY }} uses: docker/login-action@v3 @@ -57,25 +62,26 @@ jobs: with: images: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.images }} + context: ${{ github.event.issue.pull_request && 'workflow' || 'git' }} tags: | # PR images (not merged): pr- type=ref,event=pr,enable=${{ github.event.pull_request.merged == false }} # Tag with the PR base branch name on merge type=raw,value=${{ github.event.pull_request.base.ref }},enable=${{ github.event.pull_request.merged == true }} - # Manual/scheduled runs tag by branch ref (for whichever release branch the run targets) + # Manual/scheduled runs tag by branch ref type=ref,event=branch,enable=${{ contains(fromJson('["schedule", "workflow_dispatch"]'), github.event_name) }} # Comment-triggered builds: pr- - type=raw,event=default,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }} - # Supported release branches - type=raw,value=5.x,enable=${{ github.ref == 'refs/heads/5.x' || github.event.pull_request.base.ref == '5.x' }} - type=raw,value=6.x,enable=${{ github.ref == 'refs/heads/6.x' || github.event.pull_request.base.ref == '6.x' }} - type=raw,value=7.x,enable=${{ github.ref == 'refs/heads/7.x' || github.event.pull_request.base.ref == '7.x' }} + type=raw,value=pr-${{ github.event.issue.number }},enable=${{ github.event.issue.pull_request != null }} + # Supported release branches - use the fetched branch name for comments + type=raw,value=5.x,enable=${{ (github.ref_name == '5.x' || github.event.pull_request.base.ref == '5.x') && ! steps.pr-branch.outputs.head_ref }} + type=raw,value=6.x,enable=${{ (github.ref_name == '6.x' || github.event.pull_request.base.ref == '6.x') && ! steps.pr-branch.outputs.head_ref }} + type=raw,value=7.x,enable=${{ (github.ref_name == '7.x' || github.event.pull_request.base.ref == '7.x') && ! steps.pr-branch.outputs.head_ref }} # Always add an immutable sha tag - type=raw,value=sha-${{ github.sha }} + type=raw,value=sha-${{ github.event.pull_request.head.sha || steps.pr-branch.outputs.head_sha || github.sha }} labels: | - maintainer=Digital Victoria + maintainer=Victorian Department of Government Services repository=${{ github.repositoryUrl }} - org.opencontainers.image.authors=Digital Victoria + org.opencontainers.image.authors=Victorian Department of Government Services org.opencontainers.image.source=https://github.com/${{ github.repository }}/tree/${{ (contains(fromJson('["opened","synchronize"]'), github.event.action)) && github.head_ref || github.event.action == 'closed' && github.base_ref || github.ref_name }}/images/${{ matrix.images }}/Dockerfile org.opencontainers.image.title=${{ matrix.images }} org.opencontainers.image.description=${{ matrix.images }} image for Bay container platform @@ -101,6 +107,7 @@ jobs: uses: docker/bake-action@v5 with: push: true + source: . files: | ./gh-actions-bake.hcl ${{ steps.meta.outputs.bake-file }} diff --git a/images/opensearch/Dockerfile b/images/opensearch/Dockerfile index 8406edc3..be6eec21 100644 --- a/images/opensearch/Dockerfile +++ b/images/opensearch/Dockerfile @@ -2,6 +2,7 @@ FROM uselagoon/opensearch-2:latest RUN for plugin in \ analysis-kuromoji \ + ingest-attachment \ analysis-icu; do \ /usr/share/opensearch/bin/opensearch-plugin install $plugin; \ done diff --git a/images/php/Dockerfile.fpm b/images/php/Dockerfile.fpm index 845f29a8..b8a291d1 100644 --- a/images/php/Dockerfile.fpm +++ b/images/php/Dockerfile.fpm @@ -22,6 +22,7 @@ COPY log-fatals.php /bay # Change worker pool from dynamic to static. Change default value to 24. RUN sed -i "s/pm = dynamic/pm = static/" /usr/local/etc/php-fpm.d/www.conf ENV PHP_FPM_PM_MAX_CHILDREN=24 +COPY php-fpm.conf /usr/local/etc/php-fpm.d/bay-php-fpm.conf ARG TZ=Australia/Melbourne RUN apk add --no-cache tzdata \ @@ -46,6 +47,7 @@ ONBUILD ARG BAY_SESSION_COOKIE_LIFETIME=28800 ONBUILD ARG BAY_SESSION_STRICT=1 ONBUILD ARG BAY_SESSION_SID_LEN=256 ONBUILD ARG BAY_SESSION_SID_BITS=6 +ONBUILD ARG BAY_PHP_FPM_REQUEST_SLOWLOG_TIMEOUT=10s ONBUILD ENV BAY_DISABLE_FUNCTIONS $BAY_DISABLE_FUNCTIONS ONBUILD ENV BAY_UPLOAD_LIMIT $BAY_UPLOAD_LIMIT @@ -55,5 +57,6 @@ ONBUILD ENV BAY_SESSION_COOKIE_LIFETIME $BAY_SESSION_COOKIE_LIFETIME ONBUILD ENV BAY_SESSION_STRICT $BAY_SESSION_STRICT ONBUILD ENV BAY_SESSION_SID_LEN $BAY_SESSION_SID_LEN ONBUILD ENV BAY_SESSION_SID_BITS $BAY_SESSION_SID_BITS +ONBUILD ENV BAY_PHP_FPM_REQUEST_SLOWLOG_TIMEOUT $BAY_PHP_FPM_REQUEST_SLOWLOG_TIMEOUT ONBUILD RUN /bay/bay-php-config.sh diff --git a/images/php/php-fpm.conf b/images/php/php-fpm.conf new file mode 100644 index 00000000..9cf31451 --- /dev/null +++ b/images/php/php-fpm.conf @@ -0,0 +1,3 @@ +[www] +request_slowlog_timeout = ${BAY_PHP_FPM_REQUEST_SLOWLOG_TIMEOUT:-0} +slowlog = /proc/1/fd/2