Skip to content

Image Cleanup

Image Cleanup #808

Workflow file for this run

---
name: Image Cleanup
on:
workflow_dispatch:
workflow_run:
workflows: [Alpine Mainline, Alpine Stable, Debian Mainline, Debian Stable]
types: [completed]
jobs:
cleanup:
name: Delete untagged NGINX Unprivileged Docker images on the Amazon ECR Public Gallery and the GitHub Container Registry
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
steps:
- name: Check out the codebase
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Delete untagged NGINX Unprivileged Docker images on the Amazon ECR Public Gallery
run: |
.github/workflows/scripts/delete-untagged-amazon-public-ecr-images.sh
# - name: Fetch multi-platform package version SHAs
# id: multi-arch-digests
# run: |
# package=$(docker manifest inspect ghcr.io/nginxinc/nginx-unprivileged | jq -r '.manifests.[] | .digest' | paste -s -d ' ' -)
# - name: Delete untagged NGINX Unprivileged Docker images on the GitHub Container Registry
# uses: snok/container-retention-policy@4f22ef80902ad409ed55a99dc5133cc1250a0d03 # v3.0.0
# with:
# account: nginxinc
# image-names: nginx-unprivileged
# tag-selection: untagged
# cut-off: 2y
# token: ${{ secrets.GITHUB_TOKEN }}