-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (57 loc) · 2.03 KB
/
production-api-server.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
on:
push:
branches: [master]
paths:
- "server/**"
name: Production deploy to AWS ECS - "server"
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2
# Install All Dependencies
- name: Install dependencies
uses: bahmutov/npm-install@v1 # install dependencies using cache
# Build Shared Module
- name: Build shared module
id: shared-build
run: |
cd shared
yarn build
# Build API server
- name: TS Build
run: |
cd server
yarn build
- name: Build, tag, and push image to Docker Hub
uses: elgohr/Publish-Docker-Github-Action@2.14
env:
NODE_ENV: production
with:
dockerfile: server/Dockerfile
name: ${{ secrets.DOCKER_USERNAME }}/truepoint-api
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "${{ github.sha }},latest"
- 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: server/prod-task-definition.json
container-name: truepoint-api-container
image: ${{ secrets.DOCKER_USERNAME }}/truepoint-api:${{ github.sha }}
- 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: ${{ secrets.ECS_SERVICE_NAME_API_SERVER_PRODUCTION_ENV }}
cluster: ${{ secrets.ECS_CLUSTER_NAME_PRODUCTION_ENV }}
wait-for-service-stability: true