feat: log user agent, restore old and used PHP versions and actions version upgrade #221
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
pull_request: | |
push: | |
branches: "master" | |
env: | |
IMAGE_NAME: docker-php-base-image | |
COMPOSER_VERSION: ${{ vars.COMPOSER_VERSION }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tag: [8-3-2, 8-2-3, 8-1-16, 8-1-10] | |
flavour: ["", "-rootless"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and test the image | |
run: make build-${{ matrix.tag }}${{ matrix.flavour }} | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
strategy: | |
matrix: | |
tag: | |
[ | |
8.3.2-fpm-alpine3.18, | |
8.2.3-fpm-alpine3.16, | |
8.1.16-fpm-alpine3.16, | |
8.1.10-fpm-alpine3.16, | |
] | |
flavour: ["", "-rootless"] | |
steps: | |
- uses: actions/checkout@v4 | |
# Refs https://github.com/docker/login-action#github-container-registry | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check directory and Dockerfile | |
run: | | |
# Guess the folder for the php configuration | |
BASE_FOLDER=$(./scripts/guess_folder.sh "${{ matrix.tag }}") | |
if [ ! -d "$BASE_FOLDER" ]; then | |
echo "Fail to guess the configuration folder" | |
exit 1 | |
fi | |
test -d $BASE_FOLDER && test -f $BASE_FOLDER/Dockerfile | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push images to GitHub Container Registry | |
if: ${{ matrix.flavour == '' }} | |
run: | | |
# Guess the folder for the php configuration | |
BASE_FOLDER=$(./scripts/guess_folder.sh "${{ matrix.tag }}") | |
if [ ! -d "$BASE_FOLDER" ]; then | |
echo "Fail to guess the configuration folder" | |
exit 1 | |
fi | |
# Build process | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
# Change all uppercase to lowercase. | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker buildx build --push $BASE_FOLDER --platform "linux/amd64,linux/arm64" --build-arg PHPVER=${{ matrix.tag }} --tag $IMAGE_ID:${{ matrix.tag }} --target dist | |
docker buildx build --push $BASE_FOLDER --platform "linux/amd64,linux/arm64" --build-arg PHPVER=${{ matrix.tag }} --tag $IMAGE_ID:${{ matrix.tag }}-dev --target dev --build-arg COMPOSER_VERSION="${COMPOSER_VERSION}" | |
- name: Build and push images to GitHub Container Registry (rootless) | |
if: ${{ matrix.flavour == '-rootless' }} | |
run: | | |
# Guess the folder for the php configuration | |
BASE_FOLDER=$(./scripts/guess_folder.sh "${{ matrix.tag }}") | |
if [ ! -d "$BASE_FOLDER" ]; then | |
echo "Fail to guess the configuration folder" | |
exit 1 | |
fi | |
# Build process | |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
# Change all uppercase to lowercase. | |
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
echo IMAGE_ID=$IMAGE_ID | |
docker buildx build --push $BASE_FOLDER --platform "linux/amd64,linux/arm64" --build-arg PHPVER=${{ matrix.tag }} --build-arg user=1001 --tag $IMAGE_ID:${{ matrix.tag }}-rootless --target dist | |
docker buildx build --push $BASE_FOLDER --platform "linux/amd64,linux/arm64" --build-arg PHPVER=${{ matrix.tag }} --build-arg user=1001 --tag $IMAGE_ID:${{ matrix.tag }}-rootless-dev --target dev --build-arg COMPOSER_VERSION="${COMPOSER_VERSION}" |