Build and Push Container Image #151
This file contains 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 Container Image | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'Containerfile' | |
schedule: | |
- cron: "12 0 * * 0" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete huge unnecessary tools folder | |
run: rm -rf /opt/hostedtoolcache | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install QEMU | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- name: Build Image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
oci: true | |
image: dotfiles | |
tags: latest | |
context: . | |
containerfiles: | | |
./Containerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
- name: Prune Untagged Images on ghcr.io | |
uses: Chizkiyahu/delete-untagged-ghcr-action@v2 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
repository_owner: ${{ github.repository_owner }} | |
repository: ${{ github.repository }} | |
package_name: dotfiles | |
untagged_only: true | |
owner_type: user | |
- name: Push To ghcr.io | |
id: push-to-ghcr | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ghcr.io/sainnhe | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push To quay.io | |
id: push-to-quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: quay.io/sainnhe | |
username: sainnhe | |
password: ${{ secrets.QUAY_PASSWORD }} |