Skip to content

Build and Publish Docker Image #23

Build and Publish Docker Image

Build and Publish Docker Image #23

Workflow file for this run

name: Build and Publish Docker Image
on:
workflow_run:
workflows: ["Test"]
types:
- completed
jobs:
build_and_push:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Lowercase GitHub repository name
run: |
echo "IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish a Docker image for ${{ github.repository }}
uses: docker/build-push-action@v3
with:
context: .
file: ./Containerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ env.IMAGE_NAME }}:${{ github.ref_name }}