我想知道如何才能强制我的本地无服务器部署模仿我将其部署到AWS时发生的情况。
这是我的无服务器yaml文件:
service: payment # NOTE: update this with your service name
# You can pin your service to only deploy with a specific Serverless version
# Check out our docs for more details
# frameworkVersion: "=X.X.X"
environment:
SLS_DEBUG: "*"
provider:
name: aws
runtime: nodejs8.10
stage: production
region: ca-central-1
timeout: 60
role: ${file(../config/prod.env.json):ROLE}
vpc:
securityGroupIds:
- ${file(../config/prod.env.json):SECURITY_GROUP}
subnetIds:
- ${file(../config/prod.env.json):SUBNET}
apiGateway:
apiKeySourceType: HEADER
apiKeys:
- ${file(../config/prod.env.json):APIKEY}
package:
include:
- ../lib/**
functions:
- '${file(src/handlers/payment.serverless.yml)}'
plugins:
- serverless-offline我的文件结构如下所示:
root
--- node_modules
--- lib
- models
--- payment
- serverless.yml当我将它部署到AWS时,lib文件夹被放到lambda函数的文件夹中,但在本地我需要定义它的路径,通常是../.../../
如何才能在本地或部署时不必更改路径?
发布于 2018-12-19 02:33:39
有一个非常接近aws lambda的docker容器。您可以将您的无服务器部署到容器上,并对您想要做的事情进行反复试验。您还可以通过这种方式创建一个serverless支持的lambda层。
https://stackoverflow.com/questions/53817238
复制相似问题