|
9 | 9 | - main |
10 | 10 | workflow_dispatch: {} |
11 | 11 |
|
| 12 | +# Deployment requirements: |
| 13 | +# - secrets.DOCKERHUB_TOKEN is a Personal Access Token for hub.docker.com with Read & Write access |
| 14 | +# - secrets.ECR_PUBLIC_AWS_ACCESS_KEY_ID & secrets.ECR_PUBLIC_AWS_SECRET_ACCESS_KEY are for an AWS IAM User with the policy: |
| 15 | +# { |
| 16 | +# "Version": "2012-10-17", |
| 17 | +# "Statement": [ |
| 18 | +# { |
| 19 | +# "Effect": "Allow", |
| 20 | +# "Action": [ |
| 21 | +# "ecr-public:InitiateLayerUpload", |
| 22 | +# "ecr-public:UploadLayerPart", |
| 23 | +# "ecr-public:PutImage", |
| 24 | +# "ecr-public:CompleteLayerUpload", |
| 25 | +# "ecr-public:BatchCheckLayerAvailability", |
| 26 | +# "ecr-public:DescribeImages", |
| 27 | +# "ecr-public:BatchDeleteImage" |
| 28 | +# ], |
| 29 | +# "Resource": "arn:aws:ecr-public::<aws-account-here>:repository/refacto" |
| 30 | +# }, |
| 31 | +# { |
| 32 | +# "Effect": "Allow", |
| 33 | +# "Action": [ |
| 34 | +# "sts:GetServiceBearerToken", |
| 35 | +# "ecr-public:GetAuthorizationToken" |
| 36 | +# ], |
| 37 | +# "Resource": "*" |
| 38 | +# } |
| 39 | +# ] |
| 40 | +# } |
| 41 | +# (DescribeImages & BatchDeleteImage are required for auto-pruning old images. The rest are needed by docker/build-push-action) |
| 42 | + |
12 | 43 | jobs: |
13 | 44 | build_and_test: |
14 | 45 | runs-on: ubuntu-latest |
@@ -124,39 +155,16 @@ jobs: |
124 | 155 | registry: docker.io |
125 | 156 | username: refacto |
126 | 157 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
127 | | - - name: Authenticate with Public ECR |
| 158 | + - name: Authenticate with AWS |
| 159 | + uses: aws-actions/configure-aws-credentials@v5 |
| 160 | + with: |
| 161 | + aws-access-key-id: ${{ secrets.ECR_PUBLIC_AWS_ACCESS_KEY_ID }} |
| 162 | + aws-secret-access-key: ${{ secrets.ECR_PUBLIC_AWS_SECRET_ACCESS_KEY }} |
| 163 | + aws-region: us-east-1 # ECR public is only available via the N. Virginia region |
| 164 | + - name: Authenticate with ECR Public |
128 | 165 | uses: docker/login-action@v3 |
129 | | - # this uses an access key for an IAM user with the policy: |
130 | | - # { |
131 | | - # "Version": "2012-10-17", |
132 | | - # "Statement": [ |
133 | | - # { |
134 | | - # "Effect": "Allow", |
135 | | - # "Action": [ |
136 | | - # "ecr-public:InitiateLayerUpload", |
137 | | - # "ecr-public:UploadLayerPart", |
138 | | - # "ecr-public:PutImage", |
139 | | - # "ecr-public:CompleteLayerUpload", |
140 | | - # "ecr-public:BatchCheckLayerAvailability" |
141 | | - # ], |
142 | | - # "Resource": "arn:aws:ecr-public::<aws-account-here>:repository/refacto" |
143 | | - # }, |
144 | | - # { |
145 | | - # "Effect": "Allow", |
146 | | - # "Action": [ |
147 | | - # "sts:GetServiceBearerToken", |
148 | | - # "ecr-public:GetAuthorizationToken" |
149 | | - # ], |
150 | | - # "Resource": "*" |
151 | | - # } |
152 | | - # ] |
153 | | - # } |
154 | 166 | with: |
155 | 167 | registry: public.ecr.aws |
156 | | - username: ${{ secrets.ECR_PUBLIC_AWS_ACCESS_KEY_ID }} |
157 | | - password: ${{ secrets.ECR_PUBLIC_AWS_SECRET_ACCESS_KEY }} |
158 | | - env: |
159 | | - AWS_REGION: us-east-1 # ECR public is only available via the N. Virginia region |
160 | 168 | - name: Set up QEMU for Cross-Architecture Builds |
161 | 169 | uses: docker/setup-qemu-action@v3 |
162 | 170 | with: |
@@ -189,6 +197,12 @@ jobs: |
189 | 197 | org.opencontainers.image.source=${{ github.repositoryUrl }} |
190 | 198 | org.opencontainers.image.licenses=GPL-3.0-or-later |
191 | 199 | org.opencontainers.image.base.name=docker.io/node:24-alpine |
| 200 | + - name: Prune old ECR images |
| 201 | + # work around lack of support for lifecycle policies in ECR Public (see https://github.com/aws/containers-roadmap/issues/1268) |
| 202 | + run: | |
| 203 | + set -e |
| 204 | + # temporary: for now, just print out the information from the repository |
| 205 | + aws ecr-public describe-images --repository-name refacto --output json |
192 | 206 |
|
193 | 207 | create_github_release: |
194 | 208 | needs: |
|
0 commit comments