ci:(wf) add app runner build change memory #13
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- master | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
name: 'Build and Push' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- run: npm install | |
- run: npm run test | |
- name: Generate tag | |
id: generate_tag | |
run: | | |
SHA=$(echo ${GITHUB_SHA} | head -c7) | |
echo "sha=${SHA}" >> $GITHUB_OUTPUT | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::961957158866:role/ecr-role | |
aws-region: us-east-2 | |
- name: Login to AWS ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build docker image | |
id: build-docker-image | |
env: | |
REGISTRY: ${{steps.login-ecr.outputs.registry}} | |
TAG: ${{ steps.generate_tag.outputs.sha }} | |
run: | | |
docker build -t $REGISTRY/masa-ci:$TAG . | |
docker push $REGISTRY/masa-ci:$TAG | |
IMAGE=$(echo $REGISTRY/masa-ci:$TAG) | |
echo "image=${IMAGE}" >> $GITHUB_OUTPUT | |
- name: Deploy | |
env: | |
IMAGE: ${{ steps.build-docker-image.outputs.IMAGE }} | |
uses: awslabs/amazon-app-runner-deploy@main | |
with: | |
service: masa-api | |
access-role-arn: arn:aws:iam::961957158866:role/app-runner-role | |
region: us-east-2 | |
cpu: 1 | |
memory: 2 | |
port: 3000 | |
image: $IMAGE | |
# - name: Push image | |
# run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/masa-api:${{ steps.generate_tag.outputs.sha }} |