-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserverless.yml
89 lines (84 loc) · 2.13 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
# serverless.yml
service: resizeS3image
plugins:
- serverless-webpack
- serverless-offline
- serverless-content-encoding
- serverless-apigw-binary
custom:
webpack:
webpackConfig: ./webpack.config.js
includeModules: true
packager: 'npm'
contentEncoding:
minimumCompressionSize: 0 # Minimum body size required for compression in bytes
apigwBinary:
types: #list of mime-types
- 'image/jpeg'
- 'image/png'
- 'image/gif'
- 'text/html'
package:
include:
- src/**
- node_modules/**
exclude:
- .git/**
- .env
- env.yml
- docker-compose.yml
- Dockerfile
- LICENSE
- CHANGELOG.md
- CODE_OF_CONDUCT.md
- README.md
- package.json
- package-lock.json
- tests/**
- yarn.lock
provider:
name: aws
runtime: nodejs12.x
region: us-west-2
stage: ${opt:stage,'dev'}
timeout: 5 # optional, in seconds, default is 6
environment:
BUCKET: ${file(env.yml):${self:provider.stage}.BUCKET}
iamRoleStatements:
- Effect: Allow
Action:
- 's3:PutObjectAcl'
- 's3:PutObject'
- 's3:ListBucket'
- 's3:GetObject'
Resource: '*'
functions:
handler:
handler: src/handler.imageprocess
name: resizeimage-${self:provider.stage}
memorySize: ${file(env.yml):${self:provider.stage}.MEMORY_SIZE}
timeout: ${file(env.yml):${self:provider.stage}.TIMEOUT}
reservedConcurrency: ${file(env.yml):${self:provider.stage}.TIMEOUT}
events:
- http:
path: /{key+}
method: get
integration: lambda-proxy
cors:
origins:
- ${file(env.yml):${self:provider.stage}.ORIGIN}
headers:
- Content-Type
- X-Amz-Date
- Authorization
- X-Api-Key
- X-Amz-Security-Token
- X-Amz-User-Agent
- Access-Control-Allow-Headers
- Access-Control-Allow-Origin
allowCredentials: true
parameters:
paths:
key: true
environment:
BUCKET: ${file(env.yml):${self:provider.stage}.BUCKET}