Distribute model repository as OCI image and update model #39
Workflow file for this run
This file contains hidden or 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: docker-ros | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| docker-ros: | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: amd64 | |
| runner: ubuntu-24.04 | |
| - platform: arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - id: slug | |
| uses: gacts/github-slug@v1 | |
| with: | |
| to-slug: ${{ github.head_ref || github.ref_name }} | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: Extract model repository | |
| shell: bash | |
| run: | | |
| # Keep the slimming probe aligned with the model image used by the demo. | |
| MODEL_IMAGE="$( | |
| docker compose -f demo/docker-compose.yml config --format json | | |
| jq -er '."x-model-mount".source' | |
| )" | |
| docker pull --platform linux/amd64 "${MODEL_IMAGE}" | |
| container_id="$(docker create --platform linux/amd64 "${MODEL_IMAGE}" /bin/true)" | |
| trap 'docker rm "${container_id}" >/dev/null' EXIT | |
| mkdir -p "${RUNNER_TEMP}/models" | |
| docker cp "${container_id}:/models/." "${RUNNER_TEMP}/models" | |
| - uses: ika-rwth-aachen/docker-ros@main | |
| with: | |
| platform: ${{ matrix.platform }} | |
| target: dev,run | |
| enable-singlearch-push: true | |
| base-image: rwthika/ros2-triton:jazzy | |
| rmw-implementation: rmw_zenoh_cpp | |
| command: ros2 launch point_cloud_object_detection point_cloud_object_detection.launch.py | |
| enable-industrial-ci: true | |
| additional-slim-build-args: >- | |
| --compose-file ../docker/slim-compose.yml | |
| --compose-workdir .. | |
| --target-compose-svc point-cloud-object-detection | |
| --dep-exclude-compose-svc-all | |
| env: | |
| ENABLE_RECURSIVE_VCS_IMPORT: 'false' | |
| FAT_IMAGE: ghcr.io/${{ github.repository }}:${{ github.ref_type == 'tag' && github.ref_name || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && 'latest' || format('latest_{0}_ci', steps.slug.outputs.slug) }}-${{ matrix.platform }} | |
| SLIM_MODEL_DIR: ${{ runner.temp }}/models | |
| SLIM_WORKSPACE: ${{ github.workspace }} | |
| TARGET_CMAKE_ARGS: -DCMAKE_EXPORT_COMPILE_COMMANDS=1 | |
| publish-manifests: | |
| needs: docker-ros | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - id: slug | |
| uses: gacts/github-slug@v1 | |
| with: | |
| to-slug: ${{ github.head_ref || github.ref_name }} | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - uses: docker/setup-buildx-action@v3 | |
| - name: Publish multi-arch manifests | |
| shell: bash | |
| env: | |
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
| REF_SLUG: ${{ steps.slug.outputs.slug }} | |
| run: | | |
| image="ghcr.io/${GITHUB_REPOSITORY,,}" | |
| tag="latest" | |
| postfix="" | |
| if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then | |
| tag="${GITHUB_REF_NAME}" | |
| elif [[ "${GITHUB_REF}" != "refs/heads/${DEFAULT_BRANCH}" ]]; then | |
| postfix="_${REF_SLUG}_ci" | |
| fi | |
| for variant in "" "-dev" "-slim"; do | |
| target="${image}:${tag}${variant}${postfix}" | |
| docker buildx imagetools create --tag "${target}" \ | |
| "${target}-amd64" "${target}-arm64" | |
| done |