test: 배포 테스트 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy AI Services to AWS Fargate | |
| on: | |
| push: | |
| branches: | |
| - master | |
| env: | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| ECR_REGISTRY: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | |
| jobs: | |
| deploy-captioning: | |
| name: Deploy Captioning Service | |
| runs-on: ubuntu-latest | |
| if: "contains(github.event.head_commit.message, '[force deploy]') || contains(join(github.event.commits.*.modified), 'captioning-service/') || contains(join(github.event.commits.*.added), 'captioning-service/')" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - 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: ${{ env.AWS_REGION }} | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Build, tag, and push image to Amazon ECR | |
| id: build-image | |
| env: | |
| ECR_REPOSITORY: captioning-service | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./captioning-service | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
| echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
| - name: Update Amazon ECS service | |
| run: | | |
| aws ecs update-service --cluster ai-services-cluster --service captioning-service --force-new-deployment | |
| deploy-classifying: | |
| name: Deploy Classifying Service | |
| runs-on: ubuntu-latest | |
| if: "contains(github.event.head_commit.message, '[force deploy]') || contains(join(github.event.commits.*.modified), 'classifying-service/') || contains(join(github.event.commits.*.added), 'classifying-service/')" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - 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: ${{ env.AWS_REGION }} | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Build, tag, and push image to Amazon ECR | |
| id: build-image | |
| env: | |
| ECR_REPOSITORY: classifying-service | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./classifying-service | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
| echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
| - name: Update Amazon ECS service | |
| run: | | |
| aws ecs update-service --cluster ai-services-cluster --service classifying-service --force-new-deployment | |
| deploy-masking: | |
| name: Deploy Masking Service | |
| runs-on: ubuntu-latest | |
| if: "contains(github.event.head_commit.message, '[force deploy]') || contains(join(github.event.commits.*.modified), 'masking-service/') || contains(join(github.event.commits.*.added), 'masking-service/')" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - 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: ${{ env.AWS_REGION }} | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v1 | |
| - name: Build, tag, and push image to Amazon ECR | |
| id: build-image | |
| env: | |
| ECR_REPOSITORY: masking-service | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./masking-service | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
| echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
| - name: Update Amazon ECS service | |
| run: | | |
| aws ecs update-service --cluster ai-services-cluster --service masking-service --force-new-deployment |