Skip to content

Commit

Permalink
add aws ecr support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan-Harty authored May 16, 2024
1 parent 3bf1fe8 commit 15e9d74
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/main.yml.bak
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,25 @@ jobs:
npx prisma generate
npm run build

- name: Log in to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1.7.0
with:
registry: <your-ecr-registry>
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: arn:aws:iam::654654236858:role/GithubActions
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: us-west-2

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

- name: Build and Push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./dockerfile
push: true
tags: <your-ecr-registry>/<repository-name>:latest
registry-url: <your-ecr-registry>
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry}}
IMAGE_TAG: ${{ github.sha}}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/ud-repo:$IMAGE_TAG .
docker push $ECR_REGISTRY/ud-repo:$IMAGE_TAG
echo "image=$ECR_REGISTRY/ud-repo:$IMAGE_TAG" >> $GITHUB_OUTPUT

0 comments on commit 15e9d74

Please sign in to comment.