Skip to content

DockerPush

DockerPush #21

Workflow file for this run

#
# Copyright (c) 2024 ZettaScale Technology
#
# This program and the accompanying materials are made available under
# the terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: Apache-2.0
#
# Contributors:
# ZettaScale Zenoh Team, <[email protected]>
#
name: DockerPush
on:
workflow_dispatch:
inputs:
tag:
type: string
description: Image tag
required: true
latest:
type: boolean
description: Also tag as "latest"
required: true
default: false
jobs:
docker-build-amd64:
name: Docker AMD64 build and push
runs-on: [self-hosted, ubuntu-22.04, X64]
steps:
- uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push AMD64 image
run: |
set -xe
docker build . -f docker/Dockerfile -t zettascaletech/roscon2024_workshop-amd64:${{ inputs.tag }} --no-cache --platform linux/amd64
docker push zettascaletech/roscon2024_workshop-amd64:${{ inputs.tag }}
docker-build-arm64:
name: Docker ARM64 build and push
runs-on: [self-hosted, ubuntu-22.04, ARM64]
steps:
- uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push ARM64 image
run: |
set -xe
docker build . -f docker/Dockerfile -t zettascaletech/roscon2024_workshop-arm64:${{ inputs.tag }} --no-cache --platform linux/arm64/v8
docker push zettascaletech/roscon2024_workshop-arm64:${{ inputs.tag }}
docker-build-manifest:
name: Docker manifest build and push
needs: [docker-build-amd64, docker-build-arm64]
runs-on: [self-hosted, ubuntu-22.04, X64]
steps:
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Pull the latest images for both architectures
run: |
set -xe
docker pull zettascaletech/roscon2024_workshop-amd64:${{ inputs.tag }}
docker pull zettascaletech/roscon2024_workshop-arm64:${{ inputs.tag }}
- name: Create and push Docker manifest
run: |
set -xe
docker manifest create --amend zettascaletech/roscon2024_workshop:${{ inputs.tag }} \
zettascaletech/roscon2024_workshop-amd64:${{ inputs.tag }} \
zettascaletech/roscon2024_workshop-arm64:${{ inputs.tag }}
docker manifest push zettascaletech/roscon2024_workshop:${{ inputs.tag }}
- name: Tag and push as latest
if: ${{ inputs.latest }}
run: |
set -xe
docker manifest create --amend zettascaletech/roscon2024_workshop:latest \
zettascaletech/roscon2024_workshop-amd64:${{ inputs.tag }} \
zettascaletech/roscon2024_workshop-arm64:${{ inputs.tag }}
docker manifest push zettascaletech/roscon2024_workshop:latest