Build and Push to ECR #24
This file contains hidden or 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
| name: Build and Push to ECR | |
| on: | |
| workflow_run: | |
| workflows: ["Build Docker Image"] | |
| types: | |
| - completed | |
| jobs: | |
| build: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| role-to-assume: arn:aws:iam::632804446443:role/github-actions-ecr-role | |
| aws-region: us-east-1 | |
| - name: Login to ECR | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Build Image | |
| run: docker build -t ai-platform:${{ github.sha }} ./ai-platform -f ai-platform/docker/Dockerfile | |
| - name: Tag Image | |
| run: docker tag ai-platform:${{ github.sha }} 632804446443.dkr.ecr.us-east-1.amazonaws.com/ai/ai-platform:${{ github.sha }} | |
| - name: Push Image | |
| run: docker push 632804446443.dkr.ecr.us-east-1.amazonaws.com/ai/ai-platform:${{ github.sha }} |