Skip to content

Commit

Permalink
Docker - Tagging Production ACR
Browse files Browse the repository at this point in the history
  • Loading branch information
amankumarrr committed May 1, 2024
1 parent 3e882e9 commit f60890c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/main-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,21 @@ jobs:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- run: |
- name: Tag Production ACR Image
run: |
# Tag the Docker image with the production tag
docker tag ${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:staging `
${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:production
- name: Push Production ACR Image
run: |
# Push the newly tagged image to ACR
docker push ${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:production
- name: ♻️ Swap slots
run: |
az webapp deployment slot swap \
--resource-group ${{ env.AZURE_RESOURCE_GROUP }} \
--name ${{ env.APP_SERVICE_NAME }} \
--slot staging \
--target-slot production
name: ♻️ Swap slots
14 changes: 14 additions & 0 deletions .github/workflows/weekly-acr-images-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Weekly ACR images cleanup

on:
pull_request:
branches:
- main
schedule:
# Monday at 2 PM UTC - https://cron.help/#0_14_*_*_MON
- cron: "0 14 * * MON"
Expand Down Expand Up @@ -38,6 +41,17 @@ jobs:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Tag Production ACR Image
run: |
# Tag the Docker image with the production tag
docker tag ${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:staging `
${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:production
- name: Push Production ACR Image
run: |
# Push the newly tagged image to ACR
docker push ${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:production
- name: Delete all untagged images
run: |
$untaggedDigests = az acr manifest list-metadata -r ${{ env.ACR_NAME }} -n `
Expand Down
2 changes: 1 addition & 1 deletion tina/tina-lock.json

Large diffs are not rendered by default.

0 comments on commit f60890c

Please sign in to comment.