Skip to content

Commit

Permalink
docker: explicit error on missing dockerfile
Browse files Browse the repository at this point in the history
When the provided Dockerfile path was not present, users would get an
error when accessing the file, and if undefined, this would amount to
ENOENT on an empty path, which isn't too friendly.

Therefore, this commit treats this lack as a separate error, since
`path` is required when the bootstrap config is non-default, this will
provide more meaningful context on the failure and its remediation.
  • Loading branch information
lbajolet-hashicorp committed Nov 29, 2024
1 parent 89abfdd commit 8934f10
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions builder/docker/dockerfile_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ func (c *DockerfileBootstrapConfig) Prepare() ([]string, error) {
return nil, nil
}

if c.DockerfilePath == "" {
return nil, fmt.Errorf("`path` is required for bootstrapping a build with `docker build`")
}

if c.BuildDir == "" {
c.BuildDir = "."
}
Expand Down

0 comments on commit 8934f10

Please sign in to comment.