Skip to content

Publish PyTorch Dev Dockers #49

Publish PyTorch Dev Dockers

Publish PyTorch Dev Dockers #49

name: Publish PyTorch Dev Dockers
on:
workflow_dispatch:
schedule:
- cron: "0 2 * * *" # Runs nightly at 2 AM UTC
jobs:
setup_metadata:
runs-on: ubuntu-24.04
outputs:
package_targets: ${{ steps.configure.outputs.package_targets }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Generating package target matrix
id: configure
env:
PYTORCH_DEV_DOCKER: true
run: python ./build_tools/fetch_package_targets.py
build-and-push-image:
strategy:
fail-fast: false
matrix:
targets: ${{ fromJSON(needs.setup_metadata.outputs.package_targets) }}
name: ${{ matrix.targets.amdgpu_family }}::Build
runs-on: azure-linux-scale-rocm
needs: [setup_metadata]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ROCm/therock_pytorch_dev_ubuntu_24_04_${{ matrix.targets.amdgpu_family }}
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Runner Health Settings
run: |
df -h
echo "python: $(which python), python3: $(which python3)"
echo "Git version: $(git --version)"
git config --global --add safe.directory $PWD
git config fetch.parallel 10
git config --global user.email "nobody@amd.com"
git config --global user.name "Nobody"
- name: Fetch sources
run: |
python3 ./build_tools/fetch_sources.py --jobs 10
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set nightly version
id: nightly_version
run: |
BASE_VERSION=$(jq -r '.["rocm-version"]' version.json)
echo "VERSION=${BASE_VERSION}rc$(date +'%Y%m%d')" >> "$GITHUB_ENV"
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.9
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
labels: |
org.opencontainers.image.title=PyTorch ROCm Dev Image
org.opencontainers.image.description=Nightly ROCm PyTorch Dev Docker for target ${{ matrix.targets.amdgpu_family }}
org.opencontainers.image.version=${{ env.VERSION }}
org.opencontainers.image.created=${{ steps.meta.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
- name: Build and push Docker image
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
with:
context: .
file: dockerfiles/pytorch-dev/pytorch_dev_ubuntu_24.04.Dockerfile
build-args: |
AMDGPU_TARGETS=${{ matrix.targets.amdgpu_family }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}