Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Store container in ghcr vs DockerHub #234

Merged
merged 1 commit into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 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 @@ -28,12 +31,20 @@ jobs:
id: get-toolchain
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' }}
- name: Login to ghcr
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
2 changes: 1 addition & 1 deletion scripts/dev_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

CLI_NAME="Rust Hypervisor Firmware"

CTR_IMAGE_TAG="rusthypervisorfirmware/dev"
CTR_IMAGE_TAG="ghcr.io/cloud-hypervisor/rust-hypervisor-firmware"
CTR_IMAGE_VERSION="latest"
CTR_IMAGE="${CTR_IMAGE_TAG}:${CTR_IMAGE_VERSION}"

Expand Down