mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Moving dep builds into Dockerfile and multi-stage builds.
This commit is contained in:
committed by
Denis Makogon
parent
0276a1c156
commit
f628e39490
@@ -36,6 +36,16 @@ func GetLangHelper(lang string) LangHelper {
|
||||
}
|
||||
|
||||
type LangHelper interface {
|
||||
// BuildFromImage is the base image to build off, typically funcy/LANG:dev
|
||||
BuildFromImage() string
|
||||
// RunFromImage is the base image to use for deployment (usually smaller than the build images)
|
||||
RunFromImage() string
|
||||
// If set to false, it will use a single Docker build step, rather than multi-stage
|
||||
IsMultiStage() bool
|
||||
// Dockerfile build lines for building dependencies or anything else language specific
|
||||
DockerfileBuildCmds() []string
|
||||
// DockerfileCopyCmds will run in second/final stage of multi-stage build to copy artifacts form the build stage
|
||||
DockerfileCopyCmds() []string
|
||||
// Entrypoint sets the Docker Entrypoint. One of Entrypoint or Cmd is required.
|
||||
Entrypoint() string
|
||||
// Cmd sets the Docker command. One of Entrypoint or Cmd is required.
|
||||
@@ -54,10 +64,19 @@ type LangHelper interface {
|
||||
type BaseHelper struct {
|
||||
}
|
||||
|
||||
func (h *BaseHelper) Cmd() string { return "" }
|
||||
func (h *BaseHelper) HasBoilerplate() bool { return false }
|
||||
func (h *BaseHelper) GenerateBoilerplate() error { return nil }
|
||||
func (h *BaseHelper) BuildFromImage() string { return "" }
|
||||
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) 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) HasBoilerplate() bool { return false }
|
||||
func (h *BaseHelper) GenerateBoilerplate() error { return nil }
|
||||
|
||||
// exists checks if a file exists
|
||||
func exists(name string) bool {
|
||||
if _, err := os.Stat(name); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
|
||||
Reference in New Issue
Block a user