diff --git a/internal/build/imgsrc/depot.go b/internal/build/imgsrc/depot.go index 0ad2248a06..a91201c203 100644 --- a/internal/build/imgsrc/depot.go +++ b/internal/build/imgsrc/depot.go @@ -181,6 +181,13 @@ func initBuilder(ctx context.Context, buildState *build, appName string, streams region = regionEnv } + if region == "" { + closestRegion, err := apiClient.GetNearestRegion(ctx) + if err == nil { + region = closestRegion.Code + } + } + if region != "" { region = "fly-" + region } diff --git a/internal/build/imgsrc/resolver.go b/internal/build/imgsrc/resolver.go index db04711fdd..a8b5478df0 100644 --- a/internal/build/imgsrc/resolver.go +++ b/internal/build/imgsrc/resolver.go @@ -242,7 +242,7 @@ func (r *Resolver) BuildImage(ctx context.Context, streams *iostreams.IOStreams, return nil, fmt.Errorf("invalid depot-scope value. must be 'org' or 'app'") } - builderSize := flag.GetString(ctx, "depot-builder-size") + builderSize := flag.GetInt(ctx, "depot-builder-size") region := flag.GetString(ctx, "depot-builder-region") update := flag.GetBool(ctx, "depot-builder-update")