Skip to content

Commit

Permalink
10 minute timeout for dockerfile build
Browse files Browse the repository at this point in the history
  • Loading branch information
dleviminzi committed Jan 3, 2025
1 parent 8664934 commit 3eef95d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/abstractions/image/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,16 @@ func (i *BaseImage) String() string {
// Build user image
func (b *Builder) Build(ctx context.Context, opts *BuildOpts, outputChan chan common.OutputMsg) error {
var (
dockerfile *string
authInfo, _ = auth.AuthInfoFromContext(ctx)
dockerfile *string
authInfo, _ = auth.AuthInfoFromContext(ctx)
containerSpinupTimeout = defaultContainerSpinupTimeout
)

switch {
case opts.Dockerfile != "":
opts.addPythonRequirements()
dockerfile = &opts.Dockerfile
containerSpinupTimeout = 600 * time.Second
case opts.ExistingImageUri != "":
err := b.handleCustomBaseImage(opts, outputChan)
if err != nil {
Expand Down Expand Up @@ -329,7 +331,7 @@ func (b *Builder) Build(ctx context.Context, opts *BuildOpts, outputChan chan co
return errors.New(fmt.Sprintf("container exited with error: %s\n", msg))
}

if time.Since(start) > defaultContainerSpinupTimeout && opts.Dockerfile == "" {
if time.Since(start) > containerSpinupTimeout {
outputChan <- common.OutputMsg{Done: true, Success: false, Msg: "Timeout: container not running after 180 seconds.\n"}
return errors.New("timeout: container not running after 180 seconds")
}
Expand Down

0 comments on commit 3eef95d

Please sign in to comment.