change workflow triggers #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: base docker images | |
# scheduled run every day at 00:00 GMT +03:00 | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- 'docker/Dockerfile.auv-base' | |
schedule: | |
- cron: "0 21 * * *" | |
concurrency: | |
group: base_images | |
cancel-in-progress: true | |
env: | |
BASE_IMAGE_TAG: ghcr.io/itu-auv/auv-software-base | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
host: [desktop, tegra] | |
include: | |
# configuration for desktop base image | |
- base_image: ros:noetic-ros-base | |
platform: linux/amd64 | |
architecture: amd64 | |
host: desktop | |
# configuration for tegra base image | |
- base_image: dustynv/ros:noetic-ros-base-l4t-r35.2.1 | |
platform: linux/arm64 | |
architecture: arm64 | |
host: tegra | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Github Containter Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push base image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./docker/Dockerfile.auv-base | |
platforms: ${{ matrix.platform }} | |
push: ${{ github.event_name != 'pull_request' }} | |
build-args: | | |
BASE_IMAGE=${{ matrix.base_image }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
provenance: false | |
sbom: false | |
tags: | | |
${{ env.BASE_IMAGE_TAG }}:latest-${{ matrix.architecture }} | |
${{ env.BASE_IMAGE_TAG }}:${{ github.sha }}-${{ matrix.architecture }} | |
create-manifests: | |
runs-on: ubuntu-latest | |
needs: [build-and-push] | |
if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Login to Github Containter Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create SHA manifest and push | |
run: | | |
docker manifest create \ | |
${{ env.BASE_IMAGE_TAG }}:${{ github.sha }} \ | |
--amend ${{ env.BASE_IMAGE_TAG }}:${{ github.sha }}-amd64 \ | |
--amend ${{ env.BASE_IMAGE_TAG }}:${{ github.sha }}-arm64 | |
docker manifest push ${{ env.BASE_IMAGE_TAG }}:${{ github.sha }} | |
- name: Create latest manifest and push | |
run: | | |
docker manifest create \ | |
${{ env.BASE_IMAGE_TAG }}:latest \ | |
--amend ${{ env.BASE_IMAGE_TAG }}:latest-amd64 \ | |
--amend ${{ env.BASE_IMAGE_TAG }}:latest-arm64 | |
docker manifest push ${{ env.BASE_IMAGE_TAG }}:latest |