with cgo disabled
This commit is contained in:
parent
217e9c5a4d
commit
c4663856c4
@ -34,6 +34,7 @@ func BuildGolangBin() *cobra.Command {
|
|||||||
},
|
},
|
||||||
BuildPath: "main.go",
|
BuildPath: "main.go",
|
||||||
BinName: "main",
|
BinName: "main",
|
||||||
|
CGOEnabled: false,
|
||||||
ExecuteOnEntrypoint: false,
|
ExecuteOnEntrypoint: false,
|
||||||
}).
|
}).
|
||||||
Execute(ctx)
|
Execute(ctx)
|
||||||
|
@ -26,6 +26,7 @@ type GolangBinOpts struct {
|
|||||||
BinName string
|
BinName string
|
||||||
BaseImage string
|
BaseImage string
|
||||||
ExecuteOnEntrypoint bool
|
ExecuteOnEntrypoint bool
|
||||||
|
CGOEnabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||||
@ -54,6 +55,12 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
|||||||
}
|
}
|
||||||
c = container.Workdir(c, "/src")
|
c = container.Workdir(c, "/src")
|
||||||
|
|
||||||
|
if opts.CGOEnabled {
|
||||||
|
c = c.WithEnvVariable("CGO_ENABLED", "1")
|
||||||
|
} else {
|
||||||
|
c = c.WithEnvVariable("CGO_ENABLED", "0")
|
||||||
|
}
|
||||||
|
|
||||||
build, err = golang.Cache(ctx, client, c)
|
build, err = golang.Cache(ctx, client, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -73,7 +80,7 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
|||||||
byg.Step{
|
byg.Step{
|
||||||
Execute: func(_ byg.Context) error {
|
Execute: func(_ byg.Context) error {
|
||||||
if opts.BaseImage == "" {
|
if opts.BaseImage == "" {
|
||||||
opts.BaseImage = "harbor.server.kjuulh.io/docker-proxy/library/golang"
|
opts.BaseImage = "harbor.server.kjuulh.io/docker-proxy/library/alpine"
|
||||||
}
|
}
|
||||||
|
|
||||||
binpath := "/usr/bin"
|
binpath := "/usr/bin"
|
||||||
|
Loading…
Reference in New Issue
Block a user