Skip to content

Commit

Permalink
Add local CI job for ECR image pushes
Browse files Browse the repository at this point in the history
  • Loading branch information
DVentresco committed Feb 3, 2025
1 parent b266cec commit aa71443
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Releasing Image to ECR

### Prerequisites

- `act` - version >=0.2.71
- https://nektosact.com/installation/index.html
- Logged in and authenticated to AWS

### Copy Job
At the root of the repo, run:

```shell
act -j 'release_to_ecr' --env=IMAGE_TAG=v0.1.2 --env=AWS_URL=aws.com --env-file <(aws configure export-credentials --format env)
```
Make sure to set:
- `IMAGE_TAG`
- The tag of what image you want to copy from Dockerhub to ECR
- `AWS_URL`
- The URL to our AWS instance
29 changes: 29 additions & 0 deletions .github/workflows/ecr-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: HMDA ECR Image Push


jobs:
release_to_ecr:
name: Copy Docker image from Dockerhub to ECR
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Copy Image to ECR
run: |
docker pull hmda/hmda-platform:${{ env.IMAGE_TAG }}
docker tag hmda/hmda-platform:${{ env.IMAGE_TAG }} ${{ env.AWS_URL }}/hmda/hmda-platform:${{ env.IMAGE_TAG }}
docker push ${{ env.AWS_URL }}/hmda/hmda-platform:${{ env.IMAGE_TAG }}
- name: Cleanup images
run: |
docker rmi hmda/hmda-platform:${{ env.IMAGE_TAG }}
docker rmi ${{ env.AWS_URL }}/hmda/hmda-platform:${{ env.IMAGE_TAG }}

0 comments on commit aa71443

Please sign in to comment.