From e2cab2c64cbe3cd45931260406a456832936eaa6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 17 Jul 2025 14:28:13 +0200 Subject: [PATCH] cli/command/image: remove use of api.NoBaseImageSpecifier Signed-off-by: Sebastiaan van Stijn --- cli/command/image/build.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 6c6db76675..d51078496d 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -24,7 +24,6 @@ import ( "github.com/docker/cli/internal/jsonstream" "github.com/docker/cli/internal/lazyregexp" "github.com/docker/cli/opts" - "github.com/docker/docker/api" buildtypes "github.com/docker/docker/api/types/build" "github.com/docker/docker/api/types/container" registrytypes "github.com/docker/docker/api/types/registry" @@ -437,6 +436,10 @@ type resolvedTag struct { tagRef reference.NamedTagged } +// noBaseImageSpecifier is the symbol used by the FROM +// command to specify that no base image is to be used. +const noBaseImageSpecifier = "scratch" + // rewriteDockerfileFromForContentTrust rewrites the given Dockerfile by resolving images in // "FROM " instructions to a digest reference. `translator` is a // function that takes a repository name and tag reference and returns a @@ -451,7 +454,7 @@ func rewriteDockerfileFromForContentTrust(ctx context.Context, dockerfile io.Rea line := scanner.Text() matches := dockerfileFromLinePattern.FindStringSubmatch(line) - if matches != nil && matches[1] != api.NoBaseImageSpecifier { + if matches != nil && matches[1] != noBaseImageSpecifier { // Replace the line with a resolved "FROM repo@digest" var ref reference.Named ref, err = reference.ParseNormalizedNamed(matches[1])