File tree Expand file tree Collapse file tree 7 files changed +8012
-8223
lines changed Expand file tree Collapse file tree 7 files changed +8012
-8223
lines changed Original file line number Diff line number Diff line change
1
+ name : Deploy to Production
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ permissions :
9
+ id-token : write
10
+ contents : read
11
+
12
+ jobs :
13
+ test :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+
18
+ - name : Setup Node.js
19
+ uses : actions/setup-node@v4
20
+ with :
21
+ node-version : ' 20'
22
+
23
+ - name : Install dependencies
24
+ run : |
25
+ cd backend
26
+ npm ci
27
+
28
+ - name : Run unit tests
29
+ run : |
30
+ cd backend
31
+ npm test
32
+
33
+ - name : Run CDK tests
34
+ run : |
35
+ cd backend
36
+ npm run test:cdk
37
+
38
+ deploy :
39
+ needs : test
40
+ runs-on : ubuntu-latest
41
+ environment : production
42
+
43
+ steps :
44
+ - uses : actions/checkout@v4
45
+
46
+ - name : Configure AWS credentials
47
+ uses : aws-actions/configure-aws-credentials@v4
48
+ with :
49
+ role-to-assume : arn:aws:iam::841162674562:role/GitHubAction-AssumeRoleWithAction
50
+ aws-region : us-east-1
51
+ role-session-name : GithubActionsDeployment
52
+
53
+ - name : Setup Node.js
54
+ uses : actions/setup-node@v4
55
+ with :
56
+ node-version : ' 20'
57
+
58
+ - name : Install dependencies
59
+ run : |
60
+ cd backend
61
+ npm ci
62
+
63
+ - name : Build application
64
+ run : |
65
+ cd backend
66
+ npm run build
67
+
68
+ - name : Deploy to AWS
69
+ run : |
70
+ cd backend
71
+ npm run cdk deploy -- \
72
+ --require-approval never \
73
+ --context environment=production
74
+ env :
75
+ CDK_DEFAULT_ACCOUNT : ${{ secrets.AWS_ACCOUNT_ID }}
76
+ CDK_DEFAULT_REGION : us-east-1
Original file line number Diff line number Diff line change
1
+ name : Deploy to Staging
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - staging
7
+
8
+ permissions :
9
+ id-token : write
10
+ contents : read
11
+
12
+ jobs :
13
+ test :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+
18
+ - name : Setup Node.js
19
+ uses : actions/setup-node@v4
20
+ with :
21
+ node-version : ' 20'
22
+
23
+ - name : Install dependencies
24
+ run : |
25
+ cd backend
26
+ npm ci
27
+
28
+ - name : Run unit tests
29
+ run : |
30
+ cd backend
31
+ npm test
32
+
33
+ - name : Run CDK tests
34
+ run : |
35
+ cd backend
36
+ npm run test:cdk
37
+
38
+ deploy :
39
+ needs : test
40
+ runs-on : ubuntu-latest
41
+ environment : staging
42
+
43
+ steps :
44
+ - uses : actions/checkout@v4
45
+
46
+ - name : Configure AWS credentials
47
+ uses : aws-actions/configure-aws-credentials@v4
48
+ with :
49
+ role-to-assume : arn:aws:iam::841162674562:role/GitHubAction-AssumeRoleWithAction
50
+ aws-region : us-east-1
51
+ role-session-name : GithubActionsDeployment
52
+
53
+ - name : Setup Node.js
54
+ uses : actions/setup-node@v4
55
+ with :
56
+ node-version : ' 20'
57
+
58
+ - name : Install dependencies
59
+ run : |
60
+ cd backend
61
+ npm ci
62
+
63
+ - name : Build application
64
+ run : |
65
+ cd backend
66
+ npm run build
67
+
68
+ - name : Deploy to AWS
69
+ run : |
70
+ cd backend
71
+ npm run cdk deploy -- \
72
+ --require-approval never \
73
+ --context environment=staging
74
+ env :
75
+ CDK_DEFAULT_ACCOUNT : ${{ secrets.AWS_ACCOUNT_ID }}
76
+ CDK_DEFAULT_REGION : us-east-1
Original file line number Diff line number Diff line change 1
1
FROM node:20-slim as builder
2
2
3
+ ARG NODE_ENV=production
4
+ ENV NODE_ENV=${NODE_ENV}
5
+
3
6
WORKDIR /usr/src/app
4
7
5
8
COPY package*.json ./
@@ -10,6 +13,9 @@ RUN npm run build
10
13
11
14
FROM node:20-slim
12
15
16
+ ARG NODE_ENV=production
17
+ ENV NODE_ENV=${NODE_ENV}
18
+
13
19
WORKDIR /usr/src/app
14
20
15
21
COPY package*.json ./
You can’t perform that action at this time.
0 commit comments