feat: Add possibility to test build locally with act #120
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: Build and push the image | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- 'README.md' | |
schedule: | |
- cron: '0 0 1 * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: LOCAL ACT ONLY - Set Platform | |
id: platform | |
run: | | |
echo "current_platform=${RUNNER_OS,,}/${RUNNER_ARCH,,}" >> "${GITHUB_OUTPUT}" | |
if: env.ACT == 'true' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
if: env.ACT == 'false' | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: ${{ steps.platform.outputs.current_platform || 'linux/amd64,linux/arm64' }} | |
pull: true | |
push: ${{ env.ACT == 'true' && 'false' || 'true' }} | |
tags: strathos/php-nginx-supervisord:latest |