Skip to content

Merge pull request #1888 from scpwiki/dependabot/cargo/deepwell/rustl… #402

Merge pull request #1888 from scpwiki/dependabot/cargo/deepwell/rustl…

Merge pull request #1888 from scpwiki/dependabot/cargo/deepwell/rustl… #402

name: '[backend] Docker push API'
on:
push:
branches:
- develop
- build-to-ecr # TEMP
paths:
- 'deepwell/**'
- 'install/aws/dev/docker/api/**'
- '.github/workflows/docker-build-push-api.dev.yaml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.DOCKER_PUSH_KEY }}
aws-secret-access-key: ${{ secrets.DOCKER_PUSH_SECRET }}
aws-region: us-east-2
- 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:
DOCKER_BUILDKIT: 1
ECR_REGISTRY: ${{ vars.ECR_REPOSITORY }}
ECR_REPOSITORY: wikijump/deepwell
IMAGE_TAG: ${{ github.sha }}
run: |
set -ex
docker build -f install/aws/dev/docker/api/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:dev .
docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition wikijump-deepwell-dev --query taskDefinition > task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: deepwell
image: ${{ steps.build-image.outputs.image }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: wikijump-deepwell-dev
cluster: wikijump-dev
wait-for-service-stability: true