-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add local CI job for ECR image pushes
- Loading branch information
1 parent
b266cec
commit aa71443
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |