Skip to content

Merge pull request #80 from adorsys/36-build-a-pipeline-to-automate-t… #57

Merge pull request #80 from adorsys/36-build-a-pipeline-to-automate-t…

Merge pull request #80 from adorsys/36-build-a-pipeline-to-automate-t… #57

Workflow file for this run

name: Deploy to Amazon ECS
on:
push:
branches:
- main
env:
REGISTRY: 917848404243.dkr.ecr.eu-central-1.amazonaws.com
IMAGE_NAME: kcoid4vci
ECS_SERVICE: kcoid4vci-service
ECS_CLUSTER: kcoid4vci-cluster
jobs:
build-deliver:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
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: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
- name: Update ECS Service to use the new image
run: |
aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} \
--force-new-deployment