这是indexloc提供的服务,不要输入任何密码
Skip to content

Build Combined Docker Images #13

Build Combined Docker Images

Build Combined Docker Images #13

Workflow file for this run

name: Build Combined Docker Images
on:
workflow_dispatch:
inputs:
base_image:
type: string
description: Base image to overlay CUDA-QX files into (e.g. nvcr.io/nvidia/nightly/cuda-quantum:cu12-latest)
required: false
assets_repo:
type: string
description: Retrieve artifacts from a draft release from this repo (e.g. NVIDIA/cudaqx)
required: false
assets_tag:
type: string
description: (Deprecated) Retrieve assets from a draft release with this tag (e.g. docker-files-89)
required: false
artifacts_from_run:
type: string
description: As opposed to downloading assets from a release (`asset_tag`), download them from a run of the "All Libs (Release)" workflow.
required: false
pub_tag:
type: string
description: Docker tag to use for published image (e.g. ghcr.io/nvidia/cudaqx:latest-pub, defaults to private repo if blank)
required: false
jobs:
build-combined-img:
name: Build combined cuda-quantum image
runs-on: linux-amd64-cpu8
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up context for buildx
run: |
docker context create builder_context
- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
with:
endpoint: builder_context
version: v0.19.0
driver-opts: |
network=host
image=moby/buildkit:v0.19.0
- name: Log in to GitHub CR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PACKAGE_TOKEN || github.token }}
# Do this early to help validate user inputs (if present)
- name: Fetch assets
env:
GH_TOKEN: ${{ secrets.PACKAGE_TOKEN || github.token }}
id: fetch-assets
run: |
sudo bash .github/workflows/scripts/install_git_cli.sh
if [[ -n "${{ inputs.assets_repo }}" ]] && [[ -n "${{ inputs.assets_tag }}" ]]; then
# Fetch the assets into this directory
gh release download -R ${{ inputs.assets_repo }} ${{ inputs.assets_tag }}
ls
fi
if [[ -n "${{ inputs.artifacts_from_run }}" ]]; then
# Download the artifacts from the run
gh run download -R ${{ inputs.assets_repo }} ${{ inputs.artifacts_from_run }}
mv installed_files-*/installed_files-*.zip .
ls
fi
- name: Get the base image
run: |
echo "base_image=${{ inputs.base_image || 'nvcr.io/nvidia/nightly/cuda-quantum:cu12-latest' }}" >> $GITHUB_ENV
- name: Extract tag from base image
run: |
echo "tag=$(echo $base_image | cut -d: -f2)" >> $GITHUB_ENV
- name: Build and push image
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/release/Dockerfile
build-args: |
base_image=${{ env.base_image }}
labels: |
org.opencontainers.image.source=${{ github.repositoryUrl }}
org.opencontainers.image.revision=${{ github.sha }}
tags: ${{ inputs.pub_tag || format('ghcr.io/nvidia/private/cuda-quantum:{0}-cudaqx', env.tag) }}
platforms: linux/amd64,linux/arm64
push: true