Skip to content

Merge pull request #46 from arconsis/SBE-44-fix-ecr #29

Merge pull request #46 from arconsis/SBE-44-fix-ecr

Merge pull request #46 from arconsis/SBE-44-fix-ecr #29

name: Publish NestJS image to ECR
on:
push:
branches:
- main
jobs:
publish:
name: Publish NestJS Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@261a7de32bda11ba01f4d75c4ed6caf3739e54be
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: bookstore-nestjs
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$GITHUB_SHA -t $ECR_REGISTRY/$ECR_REPOSITORY .
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
working-directory: ./bookstore-nestjs