Skip to content

Commit

Permalink
feat: using custom docker daemon (e.g podman)
Browse files Browse the repository at this point in the history
The `func` binary is now aware of DOCKER_HOST environment variable.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
  • Loading branch information
matejvasek authored Mar 2, 2021
1 parent 2f63fae commit 6d2d8c6
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 21 deletions.
11 changes: 11 additions & 0 deletions buildpacks/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"io"
"os"
"runtime"

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

// Build options for the pack client.
var network string
if runtime.GOOS == "linux" {
network = "host"
}

packOpts := pack.BuildOptions{
AppPath: f.Root,
Image: f.Image,
Builder: packBuilder,
DockerHost: os.Getenv("DOCKER_HOST"),
ContainerConfig: struct {
Network string
Volumes []string
}{Network: network, Volumes: nil},
}

// log output is either STDOUt or kept in a buffer to be printed on error.
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/boson-project/func
go 1.14

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

replace (
// Nail down k8 deps to align with transisitive deps
k8s.io/apimachinery => k8s.io/apimachinery v0.18.8
k8s.io/client-go => k8s.io/client-go v0.18.8
k8s.io/apimachinery => k8s.io/apimachinery v0.19.7
k8s.io/client-go => k8s.io/client-go v0.19.7
)
Loading

0 comments on commit 6d2d8c6

Please sign in to comment.