Skip to content

Commit 6bef21d

Browse files
committed
Delete all other images in ecr
1 parent be76d0a commit 6bef21d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/main.yml

+12
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ jobs:
4242
build-args: |
4343
DATABASE_URL=your_database_url
4444
45+
46+
47+
- name: Delete Old Images in ACR
48+
run: |
49+
# Get the list of images and filter to keep the latest one
50+
latest_image="${{ secrets.AZURE_URL }}/incstats:${{ github.sha }}"
51+
az acr repository show-tags --name sbuincstatsnorwayeastecr --repository incstats --query "[*]" -o tsv | \
52+
grep -v "$latest_image" | while read -r image; do
53+
echo "Deleting image: incstats:$image"
54+
az acr repository delete --name <your_acr_name> --image incstats:$image --yes
55+
done
56+
4557
- name: Redeploy Azure Container App
4658
run: |
4759
az containerapp revision copy \

0 commit comments

Comments
 (0)