Skip to content

Build cadvisor

Build cadvisor #42

name: Build cadvisor
on:
workflow_dispatch:
inputs:
cadvisor_version:
description: 'Version of google/cadvisor, support tag name or branch name (recommand using tag name)'
required: true
default: 'v0.47.0'
jobs:
build-arm64-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push ARM64 Version
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64
push: true
build-args: CADVISOR_VERSION=${{ github.event.inputs.cadvisor_version }}
provenance: false
sbom: false
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:latest-arm64
${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:${{ github.event.inputs.cadvisor_version }}-arm64
build-amd64-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push AMD64 Version
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
build-args: CADVISOR_VERSION=${{ github.event.inputs.cadvisor_version }}
provenance: false
sbom: false
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:latest-amd64
${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:${{ github.event.inputs.cadvisor_version }}-amd64
combine-two-images:
runs-on: ubuntu-latest
needs:
- build-arm64-version
- build-amd64-version
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Combine two images
run: |
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:latest \
-a ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:latest-amd64 \
-a ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:latest-arm64
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:${{ github.event.inputs.cadvisor_version }} \
-a ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:${{ github.event.inputs.cadvisor_version }}-amd64 \
-a ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:${{ github.event.inputs.cadvisor_version }}-arm64
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:latest
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/cadvisor:${{ github.event.inputs.cadvisor_version }}