Skip to content
Permalink
Browse files
fix(stapel): custom LD_LIBRARY_PATH in the base image might lead to f…
…ailed builds

werf overrides LD_LIBRARY_PATH to prevent unexpected behaviour but only for Stapel with Docker-daemon builds.

Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Aug 10, 2022
1 parent 1698925 commit a06a5fc644f02a5f9a22b77e0851355914e6acc1
Showing 1 changed file with 8 additions and 0 deletions.
@@ -186,6 +186,7 @@ func (c *LegacyStageImageContainer) prepareServiceRunOptions(ctx context.Context
serviceRunOptions.Workdir = "/"
serviceRunOptions.Entrypoint = stapel.BashBinPath()
serviceRunOptions.User = "0:0"
serviceRunOptions.Env["LD_LIBRARY_PATH"] = ""

stapelContainerName, err := stapel.GetOrCreateContainer(ctx)
if err != nil {
@@ -250,6 +251,13 @@ func (c *LegacyStageImageContainer) prepareInheritedCommitOptions(ctx context.Co
inheritedOptions.Entrypoint = fmt.Sprintf("[\"%s\"]", strings.Join(fromImageInspect.Config.Entrypoint, "\", \""))
}

for _, e := range fromImageInspect.Config.Env {
pair := strings.SplitN(e, "=", 2)
if pair[0] == "LD_LIBRARY_PATH" {
inheritedOptions.Env[pair[0]] = pair[1]
}
}

inheritedOptions.User = fromImageInspect.Config.User
if fromImageInspect.Config.WorkingDir != "" {
inheritedOptions.Workdir = fromImageInspect.Config.WorkingDir

0 comments on commit a06a5fc

Please sign in to comment.