Skip to content

Commit

Permalink
build: Store container in ghcr vs DockerHub
Browse files Browse the repository at this point in the history
The small team DockerHub account is going away so the logical place to
store the built container is in the GitHub container registry.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
  • Loading branch information
rbradford committed Mar 15, 2023
1 parent ab9e0a4 commit 8af84a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
paths:
- resources/Dockerfile
- rust-toolchain.toml
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
main:
Expand All @@ -29,11 +32,19 @@ jobs:
run: echo "toolchain=`rustup show active-toolchain | cut -d ' ' -f1`" >> $GITHUB_ENV

- name: Login to DockerHub
if: ${{ github.repository == 'cloud-hypervisor/rust-hypervisor-firmware' && github.event_name == 'push' }}
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=true
- name: Build
uses: docker/build-push-action@v3
Expand All @@ -44,8 +55,8 @@ jobs:
platforms: |
linux/arm64
linux/amd64
push: ${{ github.repository == 'cloud-hypervisor/rust-hypervisor-firmware' && github.event_name == 'push' }}
tags: rusthypervisorfirmware/dev:latest
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
2 changes: 2 additions & 0 deletions resources/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

FROM ubuntu:22.04 as dev

ARG TARGETARCH
Expand Down

0 comments on commit 8af84a3

Please sign in to comment.