News for hackers. Stuff that matters.
Re:Rails on Docker · Fly by Too on Thursday January 26, 2023 @01:54PM (#34536784)
The new best practice is to use the RUN --mount cache options. Making the removal of intermediate files unnecessary and speeds up the builds too. Surprised to see so few mentions of it.
Re:Rails on Docker · Fly by skrtskrt on Thursday January 26, 2023 @02:04PM (#34536981)
hard enough to stay synced with all the latest docker changes, let alone at an organizational level.

Example: in the last few years docker compose files have gone from version 2 to version 3 (missing tons of great v2 features in the name of simplification) to the newest, unnamed unnumbered version which is a merging of versions 2 and 3.

Re:Rails on Docker · Fly by samruby on Thursday January 26, 2023 @02:08PM (#34537033)
At the moment Rails is focused on simplicity/readability. I've got a gem that I'm proposing (and DHH is evaluating) that adds caching as an option: https://github.com/rubys/dockerfile-rails#overview
Re:Rails on Docker · Fly by zbentley on Thursday January 26, 2023 @02:50PM (#34537736)
As someone whose week was ruined by an overwhelming proliferation of `--mount type=cache` options throughout a complex build system, I'm not so sure.

Externally managed caches don't have a lifecycle controlled or invalidated by changes in Dockerfiles, or by docker cache-purging commands like "system prune".

That means you have to keep track of those caches yourself, which can be a pain in complex, multi-contributor environments with many layers and many builds using the same caches (intentionally or by mistake).

Re:Rails on Docker · Fly by TylerE on Thursday January 26, 2023 @05:47PM (#34539989)
Could you have the first step of the dockerfile hash itself and blow away the cache(s) if the hash changes?
Re:Rails on Docker · Fly by zbentley on Friday January 27, 2023 @06:55PM (#34553444)
Something roughly equivalent is the medium-term solve, yes. Complicated by the fact that this pattern was used by rather a lot of different folks' code.