pytorch/.github/scripts/build_publish_nightly_docker.sh
Xu Zhao 7763bb6cb3 Use the conda channel defined in docker.Makefile to install cudatoolkit (#53316)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/53316

Test Plan:
Nightly Docker build CI

This is a follow-up PR after docker moved default CUDA => 11.1. Only merge this after https://github.com/pytorch/pytorch/issues/53299 is committed.

Reviewed By: albanD

Differential Revision: D26996287

Pulled By: xuzhao9

fbshipit-source-id: 0c2e03da41d036d7aada3e07d479a3dede219f58
2021-03-12 11:18:05 -08:00

43 lines
1.4 KiB
Bash

#!/bin/sh
set -xeuo pipefail
PYTORCH_DOCKER_TAG=$(git describe --tags --always)-devel
CUDA_VERSION=11.1
# Build PyTorch nightly docker
make -f docker.Makefile \
DOCKER_REGISTRY=ghcr.io \
DOCKER_ORG=pytorch \
CUDA_VERSION=${CUDA_VERSION} \
DOCKER_IMAGE=pytorch-nightly \
DOCKER_TAG=${PYTORCH_DOCKER_TAG} \
INSTALL_CHANNEL=pytorch-nightly BUILD_TYPE=official devel-image
# Get the PYTORCH_NIGHTLY_COMMIT from the docker image
PYTORCH_NIGHTLY_COMMIT=$(docker run \
ghcr.io/pytorch/pytorch-nightly:${PYTORCH_DOCKER_TAG} \
python -c 'import torch; print(torch.version.git_version)' | head -c 7)
docker tag ghcr.io/pytorch/pytorch-nightly:${PYTORCH_DOCKER_TAG} \
ghcr.io/pytorch/pytorch-nightly:${PYTORCH_NIGHTLY_COMMIT}-cu${CUDA_VERSION}
docker tag ghcr.io/pytorch/pytorch-nightly:${PYTORCH_NIGHTLY_COMMIT}-cu${CUDA_VERSION} \
ghcr.io/pytorch/pytorch-nightly:latest
# Push the nightly docker to GitHub Container Registry
echo $GHCR_PAT | docker login ghcr.io -u pytorch --password-stdin
make -f docker.Makefile \
DOCKER_REGISTRY=ghcr.io \
DOCKER_ORG=pytorch \
DOCKER_IMAGE=pytorch-nightly \
DOCKER_TAG=${PYTORCH_NIGHTLY_COMMIT}-cu${CUDA_VERSION} \
devel-push
make -f docker.Makefile \
DOCKER_REGISTRY=ghcr.io \
DOCKER_ORG=pytorch \
DOCKER_IMAGE=pytorch-nightly \
DOCKER_TAG=latest \
devel-push