bake: fix dockerfile default if empty

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2025-07-31 10:02:44 +02:00
parent 1e50e8ddab
commit 9d56b30c42
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -2248,6 +2248,23 @@ target "app" {
require.Len(t, m["app"].Outputs, 0)
}
func TestEmptyDockerfile(t *testing.T) {
fp := File{
Name: "docker-bake.hcl",
Data: []byte(`
target "app" {
dockerfile = ""
}
`),
}
ctx := context.TODO()
m, _, err := ReadTargets(ctx, []File{fp}, []string{"app"}, nil, nil, &EntitlementConf{})
require.NoError(t, err)
require.Contains(t, m, "app")
require.Equal(t, "Dockerfile", *m["app"].Dockerfile)
}
// https://github.com/docker/buildx/issues/2859
func TestGroupTargetsWithDefault(t *testing.T) {
t.Run("OnTarget", func(t *testing.T) {