Skip to content

Commit

Permalink
fix: Docker.dockerignore file can be huge. (#8023)
Browse files Browse the repository at this point in the history
We run into some nutty error when dockerignore files get large (circleci
path):

```
#3 [internal] load metadata for docker.io/library/ubuntu:noble
#3 sha256:afb7fa05fafd7c9e9fe1ecefd45ae0531e51b736cd519c2fb8893340e4e08b59
#3 DONE 0.4s

#10 [internal] load build context
#10 sha256:8189bdeed2ad9e316ae51d8dddc8d96a01e5180ee99f9f37015f7c3dc8de7e41
#10 ERROR: rpc error: code = Internal desc = header list size to send violates the maximum size (1048896 bytes) set by server
```

This became the case with avm-transpiler as it's build context is the
root of the monorepo so it can gain access to the noir source code. The
autogenerated dockerignore file has to explicitly list every file in he
monorepo as a reverse match which eventually got so big something broke
internally to docker.

New script will not autogen the dockerignore file if its committed to
git. This PR includes a manually crafted one for avm-transpiler.
  • Loading branch information
charlielye authored Aug 15, 2024
1 parent 3ad6dd9 commit cee9d9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions avm-transpiler/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!noir
!avm-transpiler
**/target
**/node_modules
8 changes: 7 additions & 1 deletion build-system/scripts/create_dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ DOCKERFILE=$(query_manifest dockerfile $REPOSITORY)

cd $BUILD_DIR
DOCKERIGNOREFILE=$DOCKERFILE.dockerignore

# If there is a dockerignore file committed to git, use it.
if git ls-files --error-unmatch $DOCKERIGNOREFILE > /dev/null 2>&1; then
exit 0
fi

echo '*' > $DOCKERIGNOREFILE
(git ls-files; git ls-files --others --exclude-standard) | sort -u | sed 's/^/!/' >> $DOCKERIGNOREFILE
echo '**/Dockerfile*' >> $DOCKERIGNOREFILE
echo '**/Dockerfile*' >> $DOCKERIGNOREFILE

0 comments on commit cee9d9a

Please sign in to comment.