fix: exclude non source files in .dockerignore#3387
fix: exclude non source files in .dockerignore#3387onbjerg merged 3 commits intoparadigmxyz:mainfrom paolofacchinetti:main
Conversation
|
@paolofacchinetti Please check that this does not break |
.dockerignore
Outdated
| !Cargo.toml | ||
| !Cross.toml | ||
| !deny.toml | ||
| !Makefile No newline at end of file |
There was a problem hiding this comment.
Please include the licenses too
There was a problem hiding this comment.
FYI right now (before my PR) the licenses are copied during the reth binary build stage of the Dockerfile, but are not copied into the final runner container. Which means that the end user that pulls the reth image won't find the licenses in it. It seems pointless to me to copy the licenses during build time only, would you like that I add them to the final runner container by copying them across the various build stages?
Codecov Report
@@ Coverage Diff @@
## main #3387 +/- ##
==========================================
- Coverage 69.40% 69.39% -0.01%
==========================================
Files 537 537
Lines 72018 71991 -27
==========================================
- Hits 49981 49957 -24
+ Misses 22037 22034 -3
Flags with carried forward coverage won't be shown. Click here to find out more. |
Existing issue
Right now the
COPY . .instruction in the Dockerfile copies pretty almost everything from the repository into the build container (including the .git/ directory, the Dockerfile, the README, etc.) which causes two things:Solution
To fix this, I changed the /.dockerignore file to exclude all but the source files required at build-time. I've tested that this works and produces a working Docker container, while solving the issues i wrote above.
This approach to exclude all but the source files means that when new files are added to the repo that are not source files, they will be ignored by the
COPY . .instruction. New files or directories that are required during the build stage can be whitelisted in the.dockerignorefile.