Skip to content

Image Cleanup

Image Cleanup #1304

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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
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: Delete untagged NGINX Unprivileged Docker images on the GitHub Container Registry
uses: dataaxiom/ghcr-cleanup-action@cd0cdb900b5dbf3a6f2cc869f0dbb0b8211f50c4 # v1.0.16
with:
package: nginx-unprivileged
delete-ghost-images: true
delete-untagged: true
delete-partial-images: true
delete-orphaned-images: true
older-than: 2 years
token: ${{ secrets.GITHUB_TOKEN }}
validate: true