disable with entrypoint

This commit is contained in:
Kasper Juul Hermansen 2022-10-31 00:26:44 +01:00
parent d90cbb8ff4
commit 45d63c2f90
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
2 changed files with 12 additions and 6 deletions

View File

@ -32,8 +32,9 @@ func BuildGolangBin() *cobra.Command {
DockerImageOpt: &pipelines.DockerImageOpt{ DockerImageOpt: &pipelines.DockerImageOpt{
ImageName: repoName, ImageName: repoName,
}, },
BuildPath: "main.go", BuildPath: "main.go",
BinName: "main", BinName: "main",
ExecuteOnEntrypoint: true,
}). }).
Execute(ctx) Execute(ctx)
}, },

View File

@ -22,9 +22,10 @@ type DockerImageOpt struct {
type GolangBinOpts struct { type GolangBinOpts struct {
*DockerImageOpt *DockerImageOpt
BuildPath string BuildPath string
BinName string BinName string
BaseImage string BaseImage string
ExecuteOnEntrypoint bool
} }
func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline { func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
@ -85,7 +86,11 @@ func (p *Pipeline) WithGolangBin(opts *GolangBinOpts) *Pipeline {
if err != nil { if err != nil {
return err return err
} }
finalImage = c.WithEntrypoint([]string{usrbin}) if opts.ExecuteOnEntrypoint {
finalImage = c.WithEntrypoint([]string{usrbin})
} else {
finalImage = c
}
return nil return nil
}, },