Skip to content

Merge pull request #218 from oguzkaganozt/add-cpu-allocation-feature #19

Merge pull request #218 from oguzkaganozt/add-cpu-allocation-feature

Merge pull request #218 from oguzkaganozt/add-cpu-allocation-feature #19

name: Build VisionPilot Container
env:
DEFAULT_ONNXRUNTIME_VERSION: "1.22.0"
on:
workflow_dispatch:
inputs:
onnxruntime-version:
description: "ONNX Runtime version"
required: true
default: "1.22.0"
push:
branches:
- main
paths:
- 'Models/**'
- 'Modules/**'
- 'VisionPilot/**'
jobs:
build:
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
platform: [amd64, arm64]
include:
- platform: amd64
runner: ubuntu-22.04
arch-platform: linux/amd64
arch: x64
- platform: arm64
runner: ubuntu-22.04-arm
arch-platform: linux/arm64
arch: aarch64
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build VisionPilot container
uses: docker/build-push-action@v5
with:
platforms: ${{ matrix.arch-platform }}
context: .
file: ./Modules/SDV/OpenADKit/Docker/Dockerfile
build-args: |
ARCH=${{ matrix.arch }}
ONNXRUNTIME_VERSION=${{ inputs.onnxruntime-version || env.DEFAULT_ONNXRUNTIME_VERSION }}
push: true
provenance: false
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
tags: |
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }}-${{ matrix.platform }}
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ steps.date.outputs.date }}-${{ matrix.platform }}
manifest:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Get current date
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Create and push multi-arch manifest
run: |
docker manifest create ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }} \
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }}-amd64 \
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }}
docker manifest create ghcr.io/${{ github.repository_owner }}/visionpilot:${{ steps.date.outputs.date }} \
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ steps.date.outputs.date }}-amd64 \
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ steps.date.outputs.date }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/visionpilot:${{ steps.date.outputs.date }}
docker manifest create ghcr.io/${{ github.repository_owner }}/visionpilot:latest \
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }}-amd64 \
ghcr.io/${{ github.repository_owner }}/visionpilot:${{ github.sha }}-arm64
docker manifest push ghcr.io/${{ github.repository_owner }}/visionpilot:latest