-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
117 lines (111 loc) · 2.68 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
service: blah
frameworkVersion: '2'
plugins:
- serverless-webpack
- serverless-s3-sync
- serverless-apigw-binary
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, 'dev'}
lambdaHashingVersion: 20201221
variablesResolutionMode: 20210219
apiGateway:
shouldStartNameWithService: true
custom:
bucketName:
Ref: ClientAssetsBucket
bucketHostname:
Fn::GetAtt [ClientAssetsBucket, DomainName]
s3Sync:
- bucketName: ${self:custom.bucketName}
localDir: .nuxt/dist/client
- bucketName: ${self:custom.bucketName}
localDir: static
apigwBinary:
types:
- '*/*'
functions:
renderer:
handler: src/lambda/renderer.handler
memorySize: 2048
timeout: 30
environment:
NODE_ENV: production
package:
include:
- .nuxt/dist/serverless.js
- .nuxt/dist/server/**
exclude:
- .nuxt/**
- src/**
- app.js
- nuxt.config.js
- README.md
- server.js
- serverless.js
- serverless.yml
- webpack.config.js
- yarn-error.log
events:
- http:
path: /
method: any
- http:
path: /{proxy+}
method: any
- http:
path: /_nuxt/{proxy+}
method: any
integration: http-proxy
request:
uri: https://${self:custom.bucketHostname}/{proxy}
parameters:
paths:
proxy: true
- http:
path: /static/{proxy+}
method: any
integration: http-proxy
request:
uri: https://${self:custom.bucketHostname}/{proxy}
parameters:
paths:
proxy: true
resources:
Resources:
ClientAssetsBucket:
Type: AWS::S3::Bucket
Properties:
CorsConfiguration:
CorsRules:
-
AllowedOrigins:
- '*'
AllowedHeaders:
- '*'
AllowedMethods:
- GET
- HEAD
- PUT
- POST
- DELETE
MaxAge: 3000
ExposedHeaders:
- x-amz-server-side-encryption
- x-amz-request-id
- x-amz-id-2
ClientAssetsBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: ClientAssetsBucket
PolicyDocument:
Version: '2012-10-17'
Statement:
- Action: s3:GetObject,
Effect: Allow
Resource: {
Fn::Join: ['', ['arn:aws:s3:::', { Ref: ClientAssetsBucket }, '/*']],
}
Principal: '*'