← Winnitude! Search  ·  Reader Mode (1678 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 8 LINKS

Build context scan feels slow when directory contains large file tree · Issue #1409 · docker-java/docker-java

Repository navigation

Build context scan feels slow when directory contains large file tree  #1409


New issue

New issue

Closed

Closed
Build context scan feels slow when directory contains large file tree #1409 Labels
resolution/stale

Description

@swiedenfeld's profile swiedenfeld opened on Jun 7, 2020

Environment: IntelliJ IDEA 2020.2 EAP Build #IU-202.5103.13 with bundled Docker plugin 202.5103.13. Docker plugin must use docker-java, connection to Docker Desktop for Windows via npipe. Cannot find out the exact version of docker-java that is used.

Given the following minimal project setup:
node_modules with +67k files
Dockerfile with single line FROM hello-world
.dockerignore with single line node_modules

Then, run docker build . in the root directory.

Expected behaviour: The image is built instantly, because build context contains only the Dockerfile (large node_modules directory is ignored), and there are almost no instructions in the Dockerfile itself.

Observed behaviour: For +30 seconds, the screen shows "Building image..." , and after that only one file is added to the build context archive.

I assume, the build traverses all +67k files in the node_modules directory, only to find none of them have to be included. This would be very inefficient. When there are no exceptions, that allow a file below node_modules, it might skip the whole directory.

Update:
Unit test in docker-java-core, testdir has the large folder as child, .dockerignore absent:

@Test
    public void can_parse_dockerfile() throws IOException {
        File dockerFile = new File(".\\testdir\\Dockerfile");
        File baseDirectory = new File(".\\testdir");
        Dockerfile dockerfile = new Dockerfile(dockerFile, baseDirectory);
        Stopwatch stopwatch = Stopwatch.createStarted();
        Dockerfile.ScannedResult parse = dockerfile.parse();
        System.out.println("Parse took " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + "ms");
        System.out.println(parse.filesToAdd.size() + " files added");
    }

Output:

Parse took 28008ms
4 files added

Metadata

Metadata

Assignees

No one assigned

    Labels


    resolution/stale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions