Posts
ECR module update
Update ECR module with new policy
We updated ECR module with new policy that expires images with "preview-" prefix if there is more than 20 which is default value that you can change if you use max_preview_image optional variable.
To make this policy work you need to add "preview-" prefix for image tag in your staging ci action.
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_URL: ${{ secrets.STAGING_AWS_ECR_URL }}
IMAGE_TAG: preview-${{ github.sha }}
run: |
docker build -t $ECR_URL:$IMAGE_TAG .
docker tag $ECR_URL:$IMAGE_TAG $ECR_URL:$IMAGE_TAG
docker push $ECR_URL:$IMAGE_TAG
docker push $ECR_URL:$IMAGE_TAG
echo "image=$ECR_URL:$IMAGE_TAG" >> $GITHUB_OUTPUT