with cgo disabled
This commit is contained in:
parent
217e9c5a4d
commit
c4663856c4
@ -34,6 +34,7 @@ func BuildGolangBin() *cobra.Command {
|
||||
},
|
||||
BuildPath: "main.go",
|
||||
BinName: "main",
|
||||
CGOEnabled: false,
|
||||
ExecuteOnEntrypoint: false,
|
||||
}).
|
||||
Execute(ctx)
|
||||
|
@ -26,6 +26,7 @@ type GolangBinOpts struct {
|
||||
BinName string
|
||||
BaseImage string
|
||||
ExecuteOnEntrypoint bool
|
||||
CGOEnabled bool
|
||||
}
|
||||
|
||||
func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
@ -54,6 +55,12 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
}
|
||||
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)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -73,7 +80,7 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
|
||||
byg.Step{
|
||||
Execute: func(_ byg.Context) error {
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user