Leave out of the build context what the app's .dockerignore names (closes #274)
Check / check (pull_request) Skipped

Docker does not apply .dockerignore to a build context sent as a tar,
so upaas sent every file in the clone. The build now reads the ignore
file as docker build does, with the ignorefile reader of
moby/patternmatcher: <Dockerfile>.dockerignore next to the Dockerfile
if there is one, otherwise .dockerignore at the root. As Docker does,
the Dockerfile path is read as a path inside the clone, and when a
Dockerfile named Dockerfile is missing, a lowercase dockerfile next to
it is used instead. As the docker command line does, the Dockerfile and
.dockerignore are never left out. The ignore file is read through
os.Root. An ignore file that cannot be read, or a malformed pattern,
fails the build.

Model: opus-5-5
This commit is contained in:
2026-10-03 01:20:20 +00:00
committed by sneak
parent 2a2c52074d
commit 44ef69f604
6 changed files with 455 additions and 3 deletions
+1 -2
View File
@@ -25,7 +25,6 @@ import (
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/versions"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/jsonmessage"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/go-connections/nat"
@@ -660,7 +659,7 @@ func (c *Client) performBuild(
}
// Create tar archive of build context
tarArchive, err := archive.TarWithOptions(opts.ContextDir, &archive.TarOptions{})
tarArchive, err := tarBuildContext(opts.ContextDir, opts.DockerfilePath)
if err != nil {
return "", fmt.Errorf("failed to create build context: %w", err)
}