Skip to content

Commit bec1471

Browse files
Merge branch 'main' into ADE-27
2 parents c299e3a + 714e14d commit bec1471

File tree

7 files changed

+8012
-8223
lines changed

7 files changed

+8012
-8223
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

.github/workflows/deploy-staging.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

backend/Dockerfile.prod

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM node:20-slim as builder
22

3+
ARG NODE_ENV=production
4+
ENV NODE_ENV=${NODE_ENV}
5+
36
WORKDIR /usr/src/app
47

58
COPY package*.json ./
@@ -10,6 +13,9 @@ RUN npm run build
1013

1114
FROM node:20-slim
1215

16+
ARG NODE_ENV=production
17+
ENV NODE_ENV=${NODE_ENV}
18+
1319
WORKDIR /usr/src/app
1420

1521
COPY package*.json ./

0 commit comments

Comments
 (0)