Skip to content

Add GHA to build and push docker image to ECR (#62) #2

Add GHA to build and push docker image to ECR (#62)

Add GHA to build and push docker image to ECR (#62) #2

Workflow file for this run

name: Build docker image
on:
push:
branches:
- master
jobs:
docker:
name: Build and push docker image
runs-on: ubuntu-latest
environment: ${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83
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: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a
- name: Docker image
id: docker-image
run: |
echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}:${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Build and push the image
uses: docker/build-push-action@v5
id: docker-build
with:
context: ./
file: ./Dockerfile
push: true
tags:
- latest

Check failure on line 42 in .github/workflows/docker.yaml

View workflow run for this annotation

GitHub Actions / Build docker image

Invalid workflow file

The workflow is not valid. .github/workflows/docker.yaml (Line: 42, Col: 13): A sequence was not expected
- ${{ steps.docker-image.outputs.image }}