Skip to content

Commit 96acb8d

Browse files
committed
Allow preview even if no Dockefile inline and location are not defined
When using `dockerfile.inline` parameter, we would use "future" reference of something that has not already been computed during the preview stage. In this case, `dockefile.location` and `dockerfile.infile` can be empty but can be available during the processing stage. Signed-off-by: Alexandre Nicolaie <[email protected]>
1 parent 4e8cf8f commit 96acb8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

provider/internal/context.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,12 @@ func (bc *BuildContext) validate(preview bool, d *Dockerfile) (*Dockerfile, *Con
127127
return d, c, newCheckFailure(err, "context.location")
128128
}
129129

130-
if d.Location == "" && d.Inline == "" {
130+
if d.Location == "" && d.Inline == "" && !preview {
131131
// If a Dockerfile wasn't provided and our context is on-disk, then
132-
// set our Dockerfile to a default of <PATH>/Dockerfile.
132+
// set our Dockerfile to a default of <PATH>/Dockerfile. However, if
133+
// we're in preview mode, we don't want to do this because we don't
134+
// know if the inline Dockerfile parameter contains unknowns or if
135+
// we will use the default Dockerfile.
133136
d.Location = filepath.Join(c.Location, "Dockerfile")
134137
}
135138

0 commit comments

Comments
 (0)