mirror of https://github.com/knative/func.git
Re-enable build caching for local s2i builds
Signed-off-by: Matej Vašek <mvasek@redhat.com>
This commit is contained in:
parent
3e75e25506
commit
d7d45ba71a
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
@ -184,10 +185,19 @@ func (b *Builder) Build(ctx context.Context, f fn.Function, platforms []fn.Platf
|
|||
cfg.Environment = append(cfg.Environment, api.EnvironmentSpec{Name: k, Value: v})
|
||||
}
|
||||
|
||||
var artifactsMounted bool
|
||||
|
||||
for _, m := range f.Build.Mounts {
|
||||
if path.Clean(m.Destination) == "/tmp/artifacts" {
|
||||
artifactsMounted = true
|
||||
}
|
||||
cfg.BuildVolumes = append(cfg.BuildVolumes, fmt.Sprintf("%s:%s:ro,Z", m.Source, m.Destination))
|
||||
}
|
||||
|
||||
if !artifactsMounted {
|
||||
cfg.BuildVolumes = append(cfg.BuildVolumes, f.Name+"-s2i-build-cache:/tmp/artifacts")
|
||||
}
|
||||
|
||||
if runtime.GOOS == "linux" {
|
||||
cfg.DockerNetworkMode = "host"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue