Skip to content

Commit

Permalink
Added a CI job to sync images to AWS ECR Public.
Browse files Browse the repository at this point in the history
  • Loading branch information
thresheek committed Dec 13, 2024
1 parent 9bef259 commit da92b32
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Sync DockerHub with AWS ECR

on:
workflow_dispatch:
schedule:
- cron: 23 20 * * *

defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'

jobs:
sync-awsecr:
name: Sync Docker Hub to AWS ECR Public
runs-on: ubuntu-24.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.AWS_ROLE_PUBLIC_ECR }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public

- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build, tag, and push docker image to Amazon ECR Public
run: |
./sync-awsecr.sh > sync-real.sh
chmod +x sync-real.sh
./sync-real.sh

0 comments on commit da92b32

Please sign in to comment.