Skip to content

Commit

Permalink
fix(stapel): custom LD_LIBRARY_PATH in the base image might lead to f…
Browse files Browse the repository at this point in the history
…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 a06a5fc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/container_backend/legacy_stage_image_container.go
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a06a5fc

Please sign in to comment.