Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
indyjonesnl authored Mar 29, 2024
1 parent 581a538 commit 6048b32
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Docker Image CI

on:
push:
branches: ['main']
pull_request:
branches: ['main']
schedule:
- cron: '0 2 * * 0'

jobs:

build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.2', '8.3']
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
trucksnl/php-fpm
ghcr.io/trucksnl/php-fpm
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
file: ./Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: |
linux/amd64
linux/arm64
push: ${{ github.event_name != 'pull_request' }}
build-contexts: |
php=docker-image://dunglas/frankenphp:1.1-php${{ matrix.php-version }}-alpine
labels: ${{ steps.meta.outputs.labels }}
tags: |
trucksnl/frankenphp:1.1-php${{ matrix.php-version }}-alpine
trucksnl/frankenphp:1.1-php${{ matrix.php-version }}-alpine-v${{ github.run_number }}
ghcr.io/trucksnl/frankenphp:1.1-php${{ matrix.php-version }}-alpine
ghcr.io/trucksnl/frankenphp:1.1-php${{ matrix.php-version }}-alpine-v${{ github.run_number }}

0 comments on commit 6048b32

Please sign in to comment.