Revert "realistic bash user" (remove COPY layer in Dockerfile) #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
COPY
is used for "realistic bash user" (92f5129), butCOPY
comes with two main issues that made me decide to revert its use: Cache invalidation, and Windows issues. The former being the deciding factor, as the later is fixed. The long build times are not worth it.Since this
COPY
is for the user creation it's very early in the Dockerfile, and even with a fat cache layer before it (experimental indocker-multiarch
) it still adds a 20min rebuild locally way too often.Cache invalidation
COPY
has a tendency to assume that the file changed and invalidating all the following cache layers. Anything in the build context could invalidate it, even if it wasn't that file. I noticed:.dockerignore
was including thedocker/
directory, and in thedocker-multiarch
branch it included build logs.docker/
is configured with.gitattributes
to always useLF
it still ended up withCRLF
on multiple occasions.On Docker Hub it's skipping the cache almost every time. For reference:
✔ a build without the
COPY
step only took 5 minutes as it ran purely from cache - it usually takes 2-3 hours by always rebuilding from scratch.❌ the build for this PR ran without cache, twice, which took hours - first the regular build, then the Autotest rebuilt the image from scratch. 🤯
Windows issues
COPY
causes two specific issues when building on Windows:CRLF
on Windows..gitattributes
to useLF
(2ceb265), despite this the files would sometimes still be inCRLF
.While those issues are fixed, it's not worth keeping due to the build times.
Conclusion
Note: This will revert the "realistic bash user" improvements introduced in PR #8, e.g. colored prompt, etc, that are found on a real RPi with RetroPie.
It might still be achievable with RetroPie packages such as
bashwelcometweak
, and there are ways to makeCOPY
more stable. So I might revisit "realistic bash user" at a later point.Some references: