change to buildah

This commit is contained in:
Anders Rytter Hansen 2023-10-28 23:57:27 +02:00
commit 5fe213eb27

View file

@ -20,6 +20,7 @@ env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
# github.repository as <account>/<repo> # github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs: jobs:
@ -83,18 +84,44 @@ jobs:
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action # Build image using Buildah action
- name: Build and push Docker image - name: Build Image
id: build-and-push id: build_image
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a uses: redhat-actions/buildah-build@v2
with: with:
context: . containerfiles: |
push: ${{ github.event_name != 'pull_request' }} ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}, ${{ steps.meta.outputs.tags }}-38, ${{ steps.meta.outputs.tags }}-38.${{ steps.date.outputs.date }} image: ${{ env.IMAGE_NAME }}
# labels: ${{ steps.meta.outputs.labels }} tags: |
cache-from: type=gha ${{ steps.meta.outputs.tags }}, ${{ steps.meta.outputs.tags }}-38, ${{ steps.meta.outputs.tags }}-38.${{ steps.date.outputs.date }}
cache-to: type=gha,mode=max oci: false
# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
- name: Lowercase Registry
id: registry_case
uses: ASzc/change-string-case-action@v5
with:
string: ${{ env.IMAGE_REGISTRY }}
# Push the image to GHCR (Image Registry)
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
id: push
if: github.event_name != 'pull_request'
env:
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ steps.registry_case.outputs.lowercase }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
extra-args: |
--disable-content-trust
# Sign the resulting Docker image digest except on PRs. # Sign the resulting Docker image digest except on PRs.