Skip to content

Merge pull request #27 from aodn/data-origin #3

Merge pull request #27 from aodn/data-origin

Merge pull request #27 from aodn/data-origin #3

Workflow file for this run

name: Automate ECR image build steps
on:
push:
branches: [ "main" ]
jobs:
build:
name: Build image
runs-on: ubuntu-latest
steps:
- name: Code verification
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Amazon ECR "Login" Action for GitHub Actions
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to AWS ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
run: |
docker build -t $ECR_REPOSITORY:latest .
docker tag $ECR_REPOSITORY:latest $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest