Skip to content

Merge pull request #58 from arconsis/SBE-51 #95

Merge pull request #58 from arconsis/SBE-51

Merge pull request #58 from arconsis/SBE-51 #95

name: Publish Spring Boot image to ECR
on:
push:
branches:
- main
jobs:
publish:
name: Publish Spring Boot 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-springboot
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-springboot