Add alternate container engine support to Justfile #7374
+47
−42
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.
Overview
PR for #7324. Adds alternate container engine support to the
justfilefor TWiR. This PR was written with Podman in mind and was tested with that, but should work with any drop-in Docker replacement. Use it with any recipe that previously called Docker like so:For example:
Warning
Though I feel that what I've written is sound, additionally testing is immensely appreciated just to be sure, especially by the TWiR editors since they are the people who will use it the most.
Docker by default
Docker remains the default container engine, so passing in no arguments (i.e.
just website,just email) will use Docker as it always has. This is achieved by having Docker set as a global Just variable here:Which then gets used as the default value for the newly added
container-engineparameter on any recipe that used to calldocker. For example:Cons
A refactor like this usually comes with a downside or two, and this one is no exception. The obvious one here is that the
justfileis fairly more verbose, with the inclusion of parameters and default values for most recipes. This makes it less easily readable, which may hurt maintainability in the long run.The other downside has to do with the
optimize-emailrecipe. This recipe originally just called a shell script (create_optimized_email.sh), which itself explicitly calleddocker. To make it engine-agnostic, I inlined the script into thejustfileas a script recipe. Originally I implemented this as a shebang recipe, but due tonoexecissues on WSL (see here and here), I had to opt for the unstable[script(COMMAND)]attribute instead. The defaultCOMMANDofsh -eudidn't work for me in testing on WSL, so I opted forbashinstead. This could cause issues with portability on machines that don't include or symlink abashexecutable, but I had no trouble when testing it on my Windows machine with WSL and with my macOS machine.The
optimize-emailrecipe issue could also be resolved by refactoring the original script to support command line arguments (e.g.create_optimized_email.sh -c podman), but keeping things in thejustfileseemed a more elegant solution to me.Concerns
If you have any questions, comments, concerns, etc., feel free to let me know. As I said in the original issue I opened, I think this kind of compatibility support is important, but totally understand if the TWiR editors aren't interested in it.