mirror of https://github.com/docker/buildx.git
Merge pull request #2716 from jsternberg/dockerfile-size-limit
build: raise maximum size limit for dockerfile and fix size check
This commit is contained in:
commit
48153169d8
|
@ -7,13 +7,15 @@ import (
|
|||
|
||||
"github.com/docker/buildx/driver"
|
||||
"github.com/docker/buildx/util/progress"
|
||||
"github.com/docker/go-units"
|
||||
"github.com/moby/buildkit/client"
|
||||
"github.com/moby/buildkit/client/llb"
|
||||
gwclient "github.com/moby/buildkit/frontend/gateway/client"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const maxDockerfileSize = 2 * 1024 * 1024 // 2 MB
|
||||
|
||||
func createTempDockerfileFromURL(ctx context.Context, d *driver.DriverHandle, url string, pw progress.Writer) (string, error) {
|
||||
c, err := driver.Boot(ctx, ctx, d, pw)
|
||||
if err != nil {
|
||||
|
@ -44,8 +46,8 @@ func createTempDockerfileFromURL(ctx context.Context, d *driver.DriverHandle, ur
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if proto.Size(stat) > 512*1024 {
|
||||
return nil, errors.Errorf("Dockerfile %s bigger than allowed max size", url)
|
||||
if stat.Size > maxDockerfileSize {
|
||||
return nil, errors.Errorf("Dockerfile %s bigger than allowed max size (%s)", url, units.HumanSize(maxDockerfileSize))
|
||||
}
|
||||
|
||||
dt, err := ref.ReadFile(ctx, gwclient.ReadRequest{
|
||||
|
|
Loading…
Reference in New Issue