Skip to content

Change container publishing from Docker Hub to GitHub Container Registry #2

Change container publishing from Docker Hub to GitHub Container Registry

Change container publishing from Docker Hub to GitHub Container Registry #2

Workflow file for this run

name: Docker Build and Push
on:
push:
tags:
- '*'
jobs:
build:
name: Build and push to GitHub Container Registry
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Set VERSION and TAG
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.repository_owner }}" --password-stdin
- name: Setup Docker buildx
run: docker buildx create --use
- name: Run Docker buildx
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg VERSION=${{ env.VERSION }} \
--tag ghcr.io/${{ github.repository }}:${{ env.TAG }} \
--push .