Updated README with base image #12
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 container image | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
on: | |
push: | |
branches: [main] | |
# Publish semver tags as releases. | |
tags: ['v*.*.*'] | |
pull_request: | |
branches: [main] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
IMAGE_CONTEXT: "." | |
IMAGE_CONTAINERFILE: Containerfile | |
IMAGE_NAME: ${{ github.repository }} | |
REGISTRY_USER: ${{ github.actor }} | |
REGISTRY_PASSWORD: ${{ github.token }} | |
jobs: | |
podman-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
# Build container image with buildah | |
# https://github.com/redhat-actions/buildah-build | |
- name: Build container image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
context: ${{ env.IMAGE_CONTEXT }} | |
containerfiles: ${{ env.IMAGE_CONTAINERFILE }} | |
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: ${{ steps.meta.outputs.tags }} | |
layers: false | |
oci: true | |
# Log in and push container image to registry (don't push on PR) | |
# https://github.com/redhat-actions/push-to-registry | |
- name: Push to registry | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
tags: ${{ steps.meta.outputs.tags }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
if: github.event_name != 'pull_request' |