From da1ddee0ba4a908409c73cbae0b8df9030e79faf Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 11 Feb 2021 06:51:01 -0500 Subject: [PATCH] fix: override the launcher for cnb apps since the default launcher is the process launcher... --- plugins/app-json/functions.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/app-json/functions.go b/plugins/app-json/functions.go index 042600dc9..95f6d3f72 100644 --- a/plugins/app-json/functions.go +++ b/plugins/app-json/functions.go @@ -164,6 +164,7 @@ func executeScript(appName string, image string, imageTag string, phase string) common.LogInfo1(fmt.Sprintf("Executing %s task from %s: %s", phase, phaseSource, command)) isHerokuishImage := common.IsImageHerokuishBased(image, appName) + isImageCnbBased := common.IsImageCnbBased(image) dockerfileEntrypoint := "" dockerfileCommand := "" if !isHerokuishImage { @@ -224,6 +225,13 @@ func executeScript(appName string, image string, imageTag string, phase string) if os.Getenv("DOKKU_TRACE") != "" { dockerArgs = append(dockerArgs, "--env", "DOKKU_TRACE="+os.Getenv("DOKKU_TRACE")) } + if isImageCnbBased { + // TODO: handle non-linux lifecycles + // Ideally we don't have to override this but `pack` injects the web process + // as the default entrypoint, so we need to specify the launcher so the script + // runs as expected + dockerArgs = append(dockerArgs, "--entrypoint=/cnb/lifecycle/launcher") + } containerID, err := createdContainerID(appName, dockerArgs, image, script, phase) if err != nil {