Skip to content

cpu and gpu

cpu and gpu #3

Workflow file for this run

name: "Prune old GHCR images"
on:
schedule:
- cron: '0 2 * * *' # daily at 02:00 UTC
push:
branches: [ docker ]
permissions:
contents: read
packages: write
jobs:
prune:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt-get update
sudo apt-get install -y gh
- name: Delete non-latest versions
env:
OWNER: ${{ github.repository_owner }}
IMAGE: deep-learning-crash-course
run: |
echo "Fetching all versions of $OWNER/$IMAGE…"
gh api -H "Accept: application/vnd.github.v3+json" \
/orgs/$OWNER/packages/container/$IMAGE/versions \
| jq -c '.[]' \
| while read version; do
id=$(echo "$version" | jq -r '.id')
tags=$(echo "$version" | jq -r '.metadata.container.tags[]')
if [[ ! " $tags " =~ " latest " ]]; then
echo "Deleting version $id (tags: $tags)"
gh api -X DELETE \
-H "Accept: application/vnd.github.v3+json" \
/orgs/$OWNER/packages/container/$IMAGE/versions/$id
fi
done