Skip to content

Commit 6d2d8c6

Browse files
authored
feat: using custom docker daemon (e.g podman)
The `func` binary is now aware of DOCKER_HOST environment variable. Signed-off-by: Matej Vasek <mvasek@redhat.com>
1 parent 2f63fae commit 6d2d8c6

File tree

3 files changed

+74
-21
lines changed

3 files changed

+74
-21
lines changed

buildpacks/builder.go

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"os"
10+
"runtime"
1011

1112
"github.com/buildpacks/pack"
1213
"github.com/buildpacks/pack/logging"
@@ -54,10 +55,20 @@ func (builder *Builder) Build(f bosonFunc.Function) (err error) {
5455
}
5556

5657
// Build options for the pack client.
58+
var network string
59+
if runtime.GOOS == "linux" {
60+
network = "host"
61+
}
62+
5763
packOpts := pack.BuildOptions{
5864
AppPath: f.Root,
5965
Image: f.Image,
6066
Builder: packBuilder,
67+
DockerHost: os.Getenv("DOCKER_HOST"),
68+
ContainerConfig: struct {
69+
Network string
70+
Volumes []string
71+
}{Network: network, Volumes: nil},
6172
}
6273

6374
// log output is either STDOUt or kept in a buffer to be printed on error.

go.mod

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ module github.com/boson-project/func
33
go 1.14
44

55
require (
6-
github.com/buildpacks/pack v0.16.0
6+
github.com/buildpacks/pack v0.17.1-0.20210221000942-0c84b4ae7a30
77
github.com/markbates/pkger v0.17.1
88
github.com/mitchellh/go-homedir v1.1.0
99
github.com/ory/viper v1.7.4
10-
github.com/spf13/cobra v1.1.1
11-
gopkg.in/yaml.v2 v2.3.0
12-
k8s.io/api v0.18.8
13-
k8s.io/apimachinery v0.19.1
10+
github.com/spf13/cobra v1.1.3
11+
gopkg.in/yaml.v2 v2.4.0
12+
k8s.io/api v0.19.7
13+
k8s.io/apimachinery v0.19.7
1414
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
1515
knative.dev/client v0.19.1
1616
knative.dev/eventing v0.19.0
@@ -20,6 +20,6 @@ require (
2020

2121
replace (
2222
// Nail down k8 deps to align with transisitive deps
23-
k8s.io/apimachinery => k8s.io/apimachinery v0.18.8
24-
k8s.io/client-go => k8s.io/client-go v0.18.8
23+
k8s.io/apimachinery => k8s.io/apimachinery v0.19.7
24+
k8s.io/client-go => k8s.io/client-go v0.19.7
2525
)

0 commit comments

Comments
 (0)