Skip to content

TorchBench Nightly Docker Build #1061

TorchBench Nightly Docker Build

TorchBench Nightly Docker Build #1061

name: TorchBench Nightly Docker Build
on:
schedule:
# Push the nightly docker daily at 3 PM UTC
- cron: '0 15 * * *'
workflow_dispatch:
pull_request:
path:
- .github/workflows/build-nightly-docker.yml
- docker/torchbench-nightly.dockerfile
env:
DOCKER_IMAGE: 'ghcr.io/pytorch/torchbench:latest'
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
jobs:
build-push-docker:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: linux.4xlarge
environment: docker-s3-upload
steps:
- name: Checkout
uses: actions/checkout@v5
with:
submodules: recursive
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: pytorch
password: ${{ secrets.TORCHBENCH_ACCESS_TOKEN }}
- name: Build TorchBench nightly docker
id: build-torchbench-docker-image
shell: bash
run: |
set -eux
docker build \
-f docker/torchbench-nightly.dockerfile \
-t ghcr.io/pytorch/torchbench:latest \
.
# Extract pytorch version from the docker
PYTORCH_VERSION=$(docker run ghcr.io/pytorch/torchbench:latest bash -c 'python3 -c "import torch; print(torch.__version__)"')
PYTORCH_VERSION=$(echo "${PYTORCH_VERSION}" | tail -n1)
DOCKER_TAG=$(awk '{match($0, /dev[0-9]+/, arr); print arr[0]}' <<< "${PYTORCH_VERSION}")
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
docker tag ghcr.io/pytorch/torchbench:latest ghcr.io/pytorch/torchbench:${DOCKER_TAG}
- name: Push docker to remote
if: ${{ github.event_name != 'pull_request' }}
run: |
docker push ghcr.io/pytorch/torchbench:${{ env.DOCKER_TAG }}
docker push ghcr.io/pytorch/torchbench:latest
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true