-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuildspec.yml
46 lines (46 loc) · 1.43 KB
/
buildspec.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
version: 0.2
phases:
install:
commands:
- n 22.9.0
# Install all dependencies (including dependencies for running tests)
- cd back
- npm install
# Install CDK dependencies
- cd ../cdk
- npm install -g [email protected]
- npm install
- cd ../
pre_build:
commands:
- cd back
# Discover and run unit tests in the '__tests__' directory
- npm run test
# Remove all dependencies not needed for the Lambda deployment package (the packages from devDependencies in package.json)
- npm run build
# Copy artifacts to a separate folder
- mkdir function-code
- cp -r bin function-code
build:
commands:
# Archive Lambda function code and upload it to S3
- cd function-code
- aws s3 cp . s3://$S3_BUCKET/$CODEBUILD_BUILD_ID/ --recursive
# Use AWS CDK to synthesize the application
- cd ../../cdk
- cdk bootstrap
- cdk synth > ../template-export.yml
# front build
- cp ./env/$STAGE/aws.ts ../front/my-app/src/configs/
- cd ../front/my-app
- npm install -g typescript
- npm install
- npm run build
post_build:
commands:
- aws s3 rm s3://$S3_STATIC_BUCKET/ --recursive
- aws s3 cp --recursive dist s3://$S3_STATIC_BUCKET/
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID --paths "/*"
artifacts:
files:
- template-export.yml