Fix container build not using context-dir Dockerfile by default#793
Fix container build not using context-dir Dockerfile by default#7930xEDU wants to merge 6 commits intoapple:mainfrom
Conversation
There was a problem hiding this comment.
I believe docker build -f Dockerfile dir uses ./Dockerfile, not dir/Dockerfile.
I think to match that behavior, you'll have to change the flag behavior so you can distinguish no -f flag from an explicit -f Dockerfile.
Maybe change it to an optional string, and use contextDir + "/Dockerfile" as the default with it's absent.
And then two style suggestions:
-
Maybe add a helper method or getter so you don't need to duplicate this logic elsewhere.
-
Is string concatenation with "/" the right way to join paths in swift? But maybe it doesn't matter since this is a macOS-specific app anyway.
5358cd3 to
05d24e5
Compare
05d24e5 to
2dec790
Compare
|
I’ve applied the requested changes and am open to any additional suggestions or adjustments (also had a little quarrel with Git, hence the force pushes 😅). |
There was a problem hiding this comment.
We don't need this since it's not being used in the dockerfile
|
I've addressed the test changes and fixed the formatting issue! |
|
No problem at all! Supersede this if yours fully covers the same case, happy to adjust or close mine if needed 👍 |
|
@0xEDU Closing since the other changes have been merged. Feel free to open another PR if there's additional content your PR made that was not included in the merged changes, especially the tests :) |
Type of Change
Motivation and Context
This PR proposes a solution that resolves #782.
If the -f flag is not provided, I prepend the context directory before the filename so that it matches Docker’s behavior and uses the Dockerfile in the context directory.
I also added tests for this behavior.
Testing