Skip to content

Commit

Permalink
feat: enable host-built functions' dependencies (#1790)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkingland authored Jun 21, 2023
1 parent 51cb15b commit 8dc5a76
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/oci/containerize_go.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type goLayerBuilder struct{}
// the statically linked binary in a tarred layer and return the Descriptor
// and Layer metadata.
func (c goLayerBuilder) Build(cfg *buildConfig, p v1.Platform) (desc v1.Descriptor, layer v1.Layer, err error) {
// Executable
// Build the Executable
exe, err := goBuild(cfg, p) // Compile binary returning its path
if err != nil {
return
Expand Down Expand Up @@ -68,7 +68,19 @@ func goBuild(cfg *buildConfig, p v1.Platform) (binPath string, err error) {
} else {
fmt.Printf(" %v\n", filepath.Base(outpath))
}
cmd := exec.CommandContext(cfg.ctx, gobin, args...)

// Get the dependencies of the function
cmd := exec.CommandContext(cfg.ctx, gobin, "get", "f")
cmd.Env = envs
cmd.Dir = cfg.buildDir()
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
if err = cmd.Run(); err != nil {
return
}

// Build the function
cmd = exec.CommandContext(cfg.ctx, gobin, args...)
cmd.Env = envs
cmd.Dir = cfg.buildDir()
cmd.Stderr = os.Stderr
Expand Down

0 comments on commit 8dc5a76

Please sign in to comment.