/
serverless.yml
91 lines (81 loc) · 2 KB
/
serverless.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
service: devnotnull-ui
frameworkVersion: ">=2.0.0"
variablesResolutionMode: 20210326
plugins:
- serverless-offline
- serverless-deployment-bucket
- serverless-prune-plugin
custom:
##
serverless-offline:
port: 3000
##
localDevStaticFolder: build
##
siteName: devnotnull.com
## Retention
prune:
automatic: true
includeLayers: true
number: 10
##
deploymentBucket:
versioning: true
accelerate: true
##
environment: ${opt:stage, 'development'}
provider:
name: aws
runtime: nodejs12.x
timeout: 10
region: ${opt:region, 'eu-west-2'}
stackName: ${self:service}-${self:custom.environment}
environment:
NODE_RUNTIME_ENV: ${self:custom.environment}
resources:
Resources:
AssetsBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: devnotnull-ui-${self:custom.environment}
CorsConfiguration:
CorsRules:
-
AllowedOrigins:
- '*'
AllowedHeaders:
- '*'
AllowedMethods:
- PUT
- GET
- POST
MaxAge: 3000
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
PolicyDocument:
Id: MyPolicy
Version: "2012-10-17"
Statement:
- Sid: PublicReadForGetBucketObjects
Effect: Allow
Principal: '*'
Action: 's3:GetObject'
Resource: !Join
- ''
- - 'arn:aws:s3:::'
- !Ref AssetsBucket
- /*
Bucket: !Ref AssetsBucket
functions:
server:
handler: build/serverless.handler
environment:
NODE_RUNTIME_ENV: ${self:custom.environment}
events:
- http:
path: / # this matches any path, the token 'any' doesn't mean anything special
method: GET
- http:
path: /{any+} # this matches any path, the token 'any' doesn't mean anything special
method: GET