Merge pull request #7 from adityadarma/main #10
Workflow file for this run
This file contains hidden or 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 Alpine Linux Lightweight | |
on: | |
push: | |
branches: [build] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
# Define all combinations of Alpine and PHP versions | |
- alpine_version: "3.15" | |
php_version: "7.4" | |
php_number: "7" | |
tag_suffix: "7.4" | |
- alpine_version: "3.16" | |
php_version: "8.0" | |
php_number: "8" | |
tag_suffix: "8.0" | |
- alpine_version: "3.19" | |
php_version: "8.1" | |
php_number: "81" | |
tag_suffix: "8.1" | |
- alpine_version: "3.20" | |
php_version: "8.2" | |
php_number: "82" | |
tag_suffix: "8.2" | |
- alpine_version: "3.20" | |
php_version: "8.3" | |
php_number: "83" | |
tag_suffix: "8.3" | |
- alpine_version: "3.21" | |
php_version: "8.4" | |
php_number: "84" | |
tag_suffix: "8.4" | |
# Laravel-specific builds | |
- alpine_version: "3.15" | |
php_version: "7.4" | |
php_number: "7" | |
tag_suffix: "7.4-laravel" | |
environment: "laravel" | |
- alpine_version: "3.19" | |
php_version: "8.1" | |
php_number: "81" | |
tag_suffix: "8.1-laravel" | |
environment: "laravel" | |
- alpine_version: "3.20" | |
php_version: "8.3" | |
php_number: "83" | |
tag_suffix: "8.3-laravel" | |
environment: "laravel" | |
- alpine_version: "3.21" | |
php_version: "8.4" | |
php_number: "84" | |
tag_suffix: "8.4-laravel" | |
environment: "laravel" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
run: | | |
# Set environment-specific build argument if defined | |
EXTRA_ARGS="" | |
if [ "${{ matrix.environment }}" != "" ]; then | |
EXTRA_ARGS="--build-arg ENVIROMENT=${{ matrix.environment }}" | |
fi | |
# Build and push the image | |
docker buildx build --push \ | |
--platform=linux/arm64/v8,linux/amd64 \ | |
--build-arg="ALPINE_VERSION=${{ matrix.alpine_version }}" \ | |
--build-arg="PHP_VERSION=${{ matrix.php_version }}" \ | |
--build-arg="PHP_NUMBER=${{ matrix.php_number }}" \ | |
$EXTRA_ARGS \ | |
--tag adityadarma/alpine-php-nginx:${{ matrix.tag_suffix }} . |