Update base. Add platform for compose #49
This file contains 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 Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
env: | |
UBUNTU_VERSION: 22.04 | |
BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | |
# Conservative defaults for cloud providers | |
LATEST_CUDA: "pytorch-2.2.0-py3.10-cuda-11.8.0-runtime-22.04" | |
LATEST_CUDA_JUPYTER: "jupyter-pytorch-2.2.0-py3.10-cuda-11.8.0-runtime-22.04" | |
LATEST_ROCM: "pytorch-2.2.0-py3.10-rocm-5.7-runtime-22.04" | |
LATEST_ROCM_JUPYTER: "jupyter-pytorch-2.2.0-py3.10-rocm-5.7-runtime-22.04" | |
LATEST_CPU: "pytorch-2.2.0-py3.10-cpu-22.04" | |
LATEST_CPU_JUPYTER: "jupyter-pytorch-2.2.0-py3.10-cpu-22.04" | |
jobs: | |
cpu-base: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
base: | |
- "pytorch" | |
- "jupyter-pytorch" | |
python: | |
- "3.10" | |
pytorch: | |
- "2.1.1" | |
- "2.1.2" | |
- "2.2.0" | |
steps: | |
- | |
name: Free Space | |
run: | | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/.ghcup | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- | |
name: Env Setter | |
run: | | |
echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Permissions fixes | |
run: | | |
reponame="$(basename ${GITHUB_REPOSITORY})" | |
target="${HOME}/work/${reponame}/${reponame}/build/COPY*" | |
chmod -R ug+rwX ${target} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Set tags | |
run: | | |
img_path="ghcr.io/${{ env.PACKAGE_NAME }}" | |
ver_tag="${{ matrix.base }}-${{ matrix.pytorch }}-py${{ matrix.python }}-cpu-${{ env.UBUNTU_VERSION }}" | |
if [[ $ver_tag == ${{ env.LATEST_CPU }} ]]; then | |
TAGS="${img_path}:latest-cpu, ${img_path}:$ver_tag" | |
elif [[ $ver_tag == ${{ env.LATEST_CPU_JUPYTER }} ]]; then | |
TAGS="${img_path}:latest-cpu-jupyter, ${img_path}:$ver_tag" | |
else | |
TAGS="${img_path}:$ver_tag" | |
fi | |
echo "TAGS=${TAGS}" >> ${GITHUB_ENV} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: build | |
build-args: | | |
IMAGE_BASE=ghcr.io/ai-dock/${{ matrix.base }}:${{ matrix.pytorch }}-py${{ matrix.python }}-cpu-${{ env.UBUNTU_VERSION }} | |
push: true | |
# Avoids unknown/unknown architecture and extra metadata | |
provenance: false | |
tags: ${{ env.TAGS }} | |
nvidia-base: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
base: | |
- "pytorch" | |
- "jupyter-pytorch" | |
python: | |
- "3.10" | |
pytorch: | |
- "2.1.1" | |
- "2.1.2" | |
- "2.2.0" | |
cuda: | |
- "11.8.0" | |
- "12.1.0" | |
level: | |
- "runtime" | |
steps: | |
- | |
name: Free Space | |
run: | | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/.ghcup | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- | |
name: Env Setter | |
run: | | |
echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Permissions fixes | |
run: | | |
reponame="$(basename ${GITHUB_REPOSITORY})" | |
target="${HOME}/work/${reponame}/${reponame}/build/COPY*" | |
chmod -R ug+rwX ${target} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Set tags | |
run: | | |
img_path="ghcr.io/${{ env.PACKAGE_NAME }}" | |
ver_tag="${{ matrix.base }}-${{ matrix.pytorch }}-py${{ matrix.python }}-cuda-${{ matrix.cuda }}-${{ matrix.level }}-${{ env.UBUNTU_VERSION }}" | |
if [[ $ver_tag == ${{ env.LATEST_CUDA }} ]]; then | |
TAGS="${img_path}:latest, ${img_path}:latest-cuda, ${img_path}:$ver_tag" | |
elif [[ $ver_tag == ${{ env.LATEST_CUDA_JUPYTER }} ]]; then | |
TAGS="${img_path}:latest-jupyter, ${img_path}:latest-cuda-jupyter, ${img_path}:$ver_tag" | |
else | |
TAGS="${img_path}:$ver_tag" | |
fi | |
echo "TAGS=${TAGS}" >> ${GITHUB_ENV} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: build | |
build-args: | | |
IMAGE_BASE=ghcr.io/ai-dock/${{ matrix.base }}:${{ matrix.pytorch }}-py${{ matrix.python }}-cuda-${{ matrix.cuda }}-${{ matrix.level }}-${{ env.UBUNTU_VERSION }} | |
PYTORCH_VERSION=${{ matrix.pytorch }} | |
push: true | |
provenance: false | |
tags: ${{ env.TAGS }} | |
amd-base: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
base: | |
- "pytorch" | |
- "jupyter-pytorch" | |
python: | |
- "3.10" | |
pytorch: | |
- "2.1.1" | |
- "2.1.2" | |
- "2.2.0" | |
rocm: | |
- "5.7" | |
- "5.7" | |
level: | |
- "runtime" | |
exclude: | |
- rocm: "5.6" | |
pytorch: "2.2.0" | |
- rocm: "5.7" | |
pytorch: "2.1.2" | |
- rocm: "5.7" | |
pytorch: "2.1.1" | |
steps: | |
- | |
name: Free Space | |
run: | | |
df -h | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/.ghcup | |
sudo rm -rf /usr/local/share/boost | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
df -h | |
- | |
name: Env Setter | |
run: | | |
echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Permissions fixes | |
run: | | |
reponame="$(basename ${GITHUB_REPOSITORY})" | |
target="${HOME}/work/${reponame}/${reponame}/build/COPY*" | |
chmod -R ug+rwX ${target} | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Set tags | |
run: | | |
img_path="ghcr.io/${{ env.PACKAGE_NAME }}" | |
ver_tag="${{ matrix.base }}-${{ matrix.pytorch }}-py${{ matrix.python }}-rocm-${{ matrix.rocm }}-${{ matrix.level }}-${{ env.UBUNTU_VERSION }}" | |
if [[ $ver_tag == ${{ env.LATEST_ROCM }} ]]; then | |
TAGS="${img_path}:latest-rocm, ${img_path}:$ver_tag" | |
elif [[ $ver_tag == ${{ env.LATEST_ROCM_JUPYTER }} ]]; then | |
TAGS="${img_path}:latest-rocm-jupyter, ${img_path}:$ver_tag" | |
else | |
TAGS="${img_path}:$ver_tag" | |
fi | |
echo "TAGS=${TAGS}" >> ${GITHUB_ENV} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: build | |
build-args: | | |
IMAGE_BASE=ghcr.io/ai-dock/${{ matrix.base }}:${{ matrix.pytorch }}-py${{ matrix.python }}-rocm-${{ matrix.rocm }}-${{ matrix.level }}-${{ env.UBUNTU_VERSION }} | |
push: true | |
provenance: false | |
tags: ${{ env.TAGS }} |