ci(container): replace old docker workflow

This commit is contained in:
Matthew Penner 2023-02-23 13:40:04 -07:00
parent 673f7282e0
commit ab4b4e6ada
No known key found for this signature in database

View file

@ -1,4 +1,4 @@
name: Docker
name: Container
on:
push:
@ -14,16 +14,15 @@ on:
- published
jobs:
push:
name: Push
build-and-push:
name: Build and Push
runs-on: ubuntu-20.04
if: "!contains(github.ref, 'develop') || (!contains(github.event.head_commit.message, 'skip docker') && !contains(github.event.head_commit.message, 'docker skip'))"
steps:
- name: Code checkout
uses: actions/checkout@v3
- name: Docker metadata
id: docker_meta
- name: Fetch metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/pterodactyl/panel
@ -34,14 +33,8 @@ jobs:
type=ref,event=tag
type=ref,event=branch
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
@ -54,14 +47,21 @@ jobs:
run: |
sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php
- name: Build and Push
uses: docker/build-push-action@v3
- name: Build
id: build
uses: redhat-actions/buildah-build@v2
with:
context: .
file: ./Containerfile
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64 #,linux/arm64
labels: ${{ steps.docker_meta.outputs.labels }}
tags: ${{ steps.docker_meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
containerfiles: ./Containerfile
image: my-new-image
platforms: linux/amd64,linux/arm64
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
oci: true
- name: Push to GitHub Container Registry
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: ghcr.io