-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use default behavior for file flag #244
Conversation
This is the same behavior as |
@crazy-max You're right and I suppose that was mostly some inexperience on our part. I think updating the documents to reflect the fact that the implicit default path includes the |
@liboz and @crazy-max Is the default really file: core.getInput('file') || 'Dockerfile', So when specifying the the path context, the file has to be set too. Is that intended? It seems a bit redundant. Maybe that line should be something like (pardon my TypeScript): file: core.getInput('file') || [core.getInput('context'), "Dockerfile"].filter(Boolean).join("/"), |
@muru After doing some more poking around, I think you're right and that suggestion makes sense. @crazy-max What do you think about the proposed change so that the default for file is actually |
@muru @liboz As I said, this is the expected and same behavior for
You can test it yourself locally if you want: Given folder structure and files:
And the following commands and expected result: $ docker build .
OK
$ docker build ./test
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount135048529/Dockerfile: no such file or directory
$ docker build -f Dockerfile.test test
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount199981535/Dockerfile.test: no such file or directory
$ docker build -f ./test/Dockerfile.test ./test
OK
$ docker build -f ./test/Dockerfile.test .
failed to compute cache key: "/app.txt" not found: not found |
@crazy-max that's all fine, I'm not disputing that. What I'm talking of is this case:
Here, |
Yes if you don't specify a Dockerfile, that's right. So the right decision here would be to not default |
@muru After what we have just said we could replace this line: build-push-action/src/context.ts Line 60 in 0db984c
With: file: core.getInput('file'), And remove: Line 19 in 0db984c
And rely on default behavior. I'm ok with that if you want to make these changes @liboz. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also update action.yml
. See my comment #244 (comment)
@crazy-max Thanks for the comments and hints. I tried to fix all the tests. When I run it locally I only find/execute 44 tests in both the containerized tests and just running |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liboz I will take a look on the tests. Keep you in touch.
@liboz Can you squash your commits and rebase please? |
@crazy-max Done |
@crazy-max Ah, thanks for pointing that out. It was because I hadn't merged master. Thanks for reviewing 😃 |
Signed-off-by: Libo Zeng <libo@mabl.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL @tonistiigi
Our team hit this issue today, but with
buildx
the file argument needs to be specified from the root directory not just the relative directory from thecontext
(PATH
) argument .See:
This updates the readme to reflect this fact.