build: Migrate from DockerHub to ghcr

It is necessary to transition away from DockerHub as the small
organisation plan in being EOLed.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
Rob Bradford 2023-03-15 17:27:51 +00:00 committed by Rob Bradford
parent feb523ef78
commit ca96ff601b
3 changed files with 16 additions and 10 deletions

View File

@ -7,6 +7,10 @@ on:
pull_request: pull_request:
paths: resources/Dockerfile paths: resources/Dockerfile
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
main: main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -20,19 +24,19 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Login to DockerHub - name: Login to ghcr
if: ${{ github.event_name == 'push' }} uses: docker/login-action@v2
uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} registry: ${{ env.REGISTRY }}
password: ${{ secrets.DOCKERHUB_TOKEN }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta - name: Docker meta
id: meta id: meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v4
with: with:
# list of Docker images to use as base name for tags images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: cloudhypervisor/dev
# generate Docker tags based on the following events/attributes # generate Docker tags based on the following events/attributes
tags: | tags: |
type=raw,value={{date 'YYYYMMDD'}}-0 type=raw,value={{date 'YYYYMMDD'}}-0

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
#
# When changing this file don't forget to update the tag name in the # When changing this file don't forget to update the tag name in the
# .github/workflows/docker-image.yaml file if doing multiple per day # .github/workflows/docker-image.yaml file if doing multiple per day

View File

@ -6,8 +6,8 @@
CLI_NAME="Cloud Hypervisor" CLI_NAME="Cloud Hypervisor"
CTR_IMAGE_TAG="cloudhypervisor/dev" CTR_IMAGE_TAG="ghcr.io/cloud-hypervisor/cloud-hypervisor"
CTR_IMAGE_VERSION="20230301-0" CTR_IMAGE_VERSION="20230315-0"
CTR_IMAGE="${CTR_IMAGE_TAG}:${CTR_IMAGE_VERSION}" CTR_IMAGE="${CTR_IMAGE_TAG}:${CTR_IMAGE_VERSION}"
DOCKER_RUNTIME="docker" DOCKER_RUNTIME="docker"