Skip to content

Commit 252b05e

Browse files
committed
Added a CI job to sync images to AWS ECR Public.
1 parent 9bef259 commit 252b05e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/sync.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Sync DockerHub with AWS ECR
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: 23 20 * * *
7+
8+
defaults:
9+
run:
10+
shell: 'bash -Eeuo pipefail -x {0}'
11+
12+
jobs:
13+
sync-awsecr:
14+
name: Sync Docker Hub to AWS ECR Public
15+
runs-on: ubuntu-24.04
16+
permissions:
17+
id-token: write
18+
contents: read
19+
steps:
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
24+
with:
25+
role-to-assume: ${{ secrets.AWS_ROLE_PUBLIC_ECR }}
26+
aws-region: us-east-1
27+
28+
- name: Login to Amazon ECR Public
29+
id: login-ecr-public
30+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
31+
with:
32+
registry-type: public
33+
34+
- name: Login to Docker Hub
35+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
40+
- name: Build, tag, and push docker image to Amazon ECR Public
41+
run: |
42+
./sync-awsecr.sh > sync-real.sh
43+
chmod +x sync-real.sh
44+
./sync-real.sh

0 commit comments

Comments
 (0)