Skip to content

fix: megaparse.load & add tests (#202) #91

fix: megaparse.load & add tests (#202)

fix: megaparse.load & add tests (#202) #91

name: Build Docker image and push ECR
on:
push:
tags:
- "v*"
branches: [main]
env:
AWS_REGION: eu-west-1
ECR_REPOSITORY: quivrhq/megaparse
ECS_CLUSTER: megaparse
ECS_TASK_DEFINITION: .aws/task_definition.json
CONTAINER_NAME: megaparse
permissions:
contents: read
jobs:
deploy:
name: build docker
runs-on: ubuntu-latest
environment: production
outputs:
imageoutput: ${{ steps.build-image.outputs.imageoutput }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and push it to ECR
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
# Tag the image as 'latest' and push
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
echo "imageoutput=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT