[MOV-23365] feat: Use Ubuntu 24.04 image on Actions #4
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: Deploy images to Docker Hub | |
on: [push, workflow_dispatch] | |
jobs: | |
deploy: | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: true | |
max-parallel: 5 | |
matrix: | |
include: [ | |
{version: 8.0.30, alpine_version: 3.16, tag: dev }, | |
{version: 8.0.30, alpine_version: 3.16, tag: prod }, | |
{version: 8.1.31, alpine_version: 3.21, tag: dev }, | |
{version: 8.1.31, alpine_version: 3.21, tag: prod }, | |
{version: 8.2.27, alpine_version: 3.21, tag: dev }, | |
{version: 8.2.27, alpine_version: 3.21, tag: prod }, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and Push Docker images | |
run: | | |
MAJOR=$(echo ${{ matrix.version }} | cut -d. -f1) | |
MINOR=$(echo ${{ matrix.version }} | cut -d. -f2) | |
PATCH=$(echo ${{ matrix.version }} | cut -d. -f3) | |
PATCH_TAG="scaffoldeducation/php:${MAJOR}.${MINOR}.${PATCH}-${{ matrix.tag }}" | |
MINOR_TAG="scaffoldeducation/php:${MAJOR}.${MINOR}-${{ matrix.tag }}" | |
MAJOR_TAG="scaffoldeducation/php:${MAJOR}-${{ matrix.tag }}" | |
docker build \ | |
--build-arg PHP_VERSION="${{ matrix.version }}" \ | |
--build-arg ALPINE_VERSION="${{ matrix.alpine_version }}" \ | |
--target "${{ matrix.tag }}" \ | |
-f Dockerfile \ | |
-t "${PATCH_TAG}" . | |
docker tag "${PATCH_TAG}" "${MINOR_TAG}" | |
docker tag "${PATCH_TAG}" "${MAJOR_TAG}" | |
docker push "${PATCH_TAG}" | |
docker push "${MINOR_TAG}" | |
docker push "${MAJOR_TAG}" | |
if [ "${{ matrix.tag }}" == "prod" ]; then | |
docker tag "${PATCH_TAG}" "scaffoldeducation/php:${MAJOR}.${MINOR}.${PATCH}" | |
docker tag "${PATCH_TAG}" "scaffoldeducation/php:${MAJOR}.${MINOR}" | |
docker tag "${PATCH_TAG}" "scaffoldeducation/php:${MAJOR}" | |
docker tag "${PATCH_TAG}" "scaffoldeducation/php:latest" | |
docker push "scaffoldeducation/php:${MAJOR}.${MINOR}.${PATCH}" | |
docker push "scaffoldeducation/php:${MAJOR}.${MINOR}" | |
docker push "scaffoldeducation/php:${MAJOR}" | |
docker push "scaffoldeducation/php:latest" | |
fi |