esst/php #415
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: esst/php | |
on: | |
release: | |
types: | |
- created | |
schedule: | |
- cron: '0 1 * * 1' | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.ref, 'php') || github.event_name == 'schedule' }} | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
# PHP 8.3-fpm-alpine | |
- name: Test Build & Push [ PHP 8.3-fpm-alpine ] | |
if: ${{ contains(github.ref, 'php-8.3-fpm-alpine@') || github.event_name == 'schedule' }} | |
id: docker_build_php83_fpm_alpine_test | |
uses: docker/build-push-action@v6 | |
with: | |
load: true | |
file: ./php/8.3/fpm-alpine/Dockerfile | |
tags: esst/php:8.3-fpm-alpine-test | |
- name: Run container | |
if: contains(github.ref, 'php-8.3-fpm-alpine@') || github.event_name == 'schedule' | |
run: docker run -d --name php_container83 esst/php:8.3-fpm-alpine-test | |
- name: Check PHP extensions | |
if: contains(github.ref, 'php-8.3-fpm-alpine@') || github.event_name == 'schedule' | |
run: | | |
extensions=("bcmath" "exif" "gd" "intl" "ldap" "pcntl" "pdo_mysql" "xml" "mbstring" "curl" "zip" "memcached" "imagick" "redis") | |
for ext in "${extensions[@]}"; do | |
if ! docker exec php_container83 bash -c "php -m | grep -wq '$ext'"; then | |
echo "$ext extension is NOT installed" | |
exit 1 | |
fi | |
done | |
echo "All extensions are installed" | |
- name: Build & Push [ PHP 8.3-fpm-alpine ] | |
if: success() && (contains(github.ref, 'php-8.3-fpm-alpine@') || github.event_name == 'schedule') | |
id: docker_build_php83_fpm_alpine | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: ./php/8.3/fpm-alpine/Dockerfile | |
tags: esst/php:8.3-fpm-alpine | |
- name: Build & Push [ PHP 8.3-fpm-nginx-alpine ] | |
if: success() && (contains(github.ref, 'php-8.3-fpm-alpine@') || contains(github.ref, 'php-8.3-fpm-nginx-alpine@') || github.event_name == 'schedule') | |
id: docker_build_php83_fpm_nginx_alpine_test | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: ./php/8.3/fpm-alpine/Dockerfile.nginx | |
tags: esst/php:8.3-fpm-nginx-alpine |