Skip to content

Build and Push to Docker Hub #60

Build and Push to Docker Hub

Build and Push to Docker Hub #60

Workflow file for this run

name: Build and Push to Docker Hub
on:
push:
branches: [main]
schedule:
- cron: "0 1 * * *" # Run once every day
env:
REPO: zeronsd
PLATFORMS: linux/amd64
jobs:
build_and_push_docker_images:
name: Push Docker image to Docker Hub
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Build Production Images
id: build-image
uses: redhat-actions/buildah-build@b4dc19b4ba891854660ab1f88a097d45aa158f76 # v2
with:
image: ${{ env.REPO }}
tags: latest ${{ github.sha }}
containerfiles: |
./Dockerfile.ubi
# PUSH
- name: Push To GHCR
if: github.event_name != 'pull_request'
id: push-to-ghcr
uses: redhat-actions/push-to-registry@9986a6552bc4571882a4a67e016b17361412b4df # v2
with:
username: ${{ github.actor }}
password: ${{ github.token }}
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ghcr.io/${{ github.repository_owner }}
- name: Print image URLs
if: github.event_name != 'pull_request'
run: |
echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}"