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