Skip to content

Bump php from 8.2.9-cli-alpine3.18 to 8.2.10-cli-alpine3.18 in /docker #207

Bump php from 8.2.9-cli-alpine3.18 to 8.2.10-cli-alpine3.18 in /docker

Bump php from 8.2.9-cli-alpine3.18 to 8.2.10-cli-alpine3.18 in /docker #207

name: Build Docker Image
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'develop'
paths-ignore:
- '.github/**'
- '**.md'
tags:
- 'prod@*'
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
outputs:
environment: ${{ steps.prepare-build.outputs.environment }}
shorthash: ${{ steps.prepare-build.outputs.short }}
strategy:
matrix:
service: [nginx, php-fpm, php-cli]
include:
- service: nginx
target: nginx
dockerfile: nginx.Dockerfile
- service: php-fpm
target: fpm
dockerfile: php.Dockerfile
- service: php-cli
target: cli
dockerfile: php.Dockerfile
steps:
- name: Prepare build variables
id: prepare-build
run: |
echo "short=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "environment=prod" >> $GITHUB_OUTPUT
else
echo "environment=dev" >> $GITHUB_OUTPUT
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55
- name: Login to GitHub container registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# About the cache:
# https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
- name: Build ${{ matrix.service }} Docker Image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
with:
push: true
build-args:
"VERSION=${{ steps.prepare-build.outputs.environment }}-${{ steps.prepare-build.outputs.short }}"
tags: ghcr.io/package-health/${{ matrix.service }}:${{ steps.prepare-build.outputs.environment }}-${{ steps.prepare-build.outputs.short }}
file: ./docker/${{ matrix.dockerfile }}
target: ${{ matrix.target }}
cache-from: type=gha
cache-to: type=gha,mode=max
release-deploy:
needs: docker
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create release
if: ${{ github.ref_type == 'tag' }}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
name: "php.package.health ${{ needs.docker.outputs.environment }}-${{ needs.docker.outputs.shorthash }}"
generate_release_notes: true
- name: Send update to infrastructure repository
if: ${{ github.ref_type == 'tag' || github.ref_name != 'main' }}
uses: peter-evans/repository-dispatch@26b39ed245ab8f31526069329e112ab2fb224588
with:
# personal access token with "repo" scope
token: ${{ secrets.INFRA_REPO_ACCESS_TOKEN }}
repository: package-health/infra-service
event-type: deploy-new-version
client-payload: '{"sha": "${{ github.sha }}", "environment": "${{ needs.docker.outputs.environment }}"}'