Fixed up lambda-node to work with multi-stage changes.

This commit is contained in:
Travis Reeder
2017-06-19 11:28:14 -07:00
parent 345da3fcb3
commit c6a315ae7d
15 changed files with 386 additions and 30 deletions

View File

@@ -27,7 +27,7 @@ func GetLangHelper(lang string) LangHelper {
return &RustLangHelper{}
case "dotnet":
return &DotNetLangHelper{}
case "lambda-nodejs4.3":
case "lambda-nodejs4.3", "lambda-node-4":
return &LambdaNodeHelper{}
case "java":
return &JavaLangHelper{}
@@ -69,10 +69,11 @@ func (h *BaseHelper) RunFromImage() string { return h.BuildFromImage()
func (h *BaseHelper) IsMultiStage() bool { return true }
func (h *BaseHelper) DockerfileBuildCmds() []string { return []string{} }
func (h *BaseHelper) DockerfileCopyCmds() []string { return []string{} }
func (h *BaseHelper) Entrypoint() string { return "" }
func (h *BaseHelper) Cmd() string { return "" }
func (lh *BaseHelper) HasPreBuild() bool { return false }
func (lh *BaseHelper) PreBuild() error { return nil }
func (lh *BaseHelper) AfterBuild() error { return nil }
func (h *BaseHelper) HasPreBuild() bool { return false }
func (h *BaseHelper) PreBuild() error { return nil }
func (h *BaseHelper) AfterBuild() error { return nil }
func (h *BaseHelper) HasBoilerplate() bool { return false }
func (h *BaseHelper) GenerateBoilerplate() error { return nil }

View File

@@ -5,26 +5,26 @@ type LambdaNodeHelper struct {
}
func (lh *LambdaNodeHelper) BuildFromImage() string {
return "funcy/functions-lambda:nodejs4.3"
return "funcy/lambda:node-4"
}
func (lh *LambdaNodeHelper) Entrypoint() string {
return ""
func (lh *LambdaNodeHelper) IsMultiStage() bool {
return false
}
func (lh *LambdaNodeHelper) Cmd() string {
return "func.handler"
}
func (lh *LambdaNodeHelper) HasPreBuild() bool {
return false
}
// PreBuild for Go builds the binary so the final image can be as small as possible
func (lh *LambdaNodeHelper) PreBuild() error {
return nil
}
func (lh *LambdaNodeHelper) AfterBuild() error {
return nil
func (h *LambdaNodeHelper) DockerfileBuildCmds() []string {
r := []string{}
if exists("package.json") {
r = append(r,
"ADD package.json /function/",
"RUN npm install",
)
}
// single stage build for this one, so add files
r = append(r, "ADD . /function/")
return r
}