build_dockerfile: Dockerfile detection depends on filename instead of actual syntax (TODO)
#1771
Unanswered
Syedowais312
asked this question in
Ideas
Replies: 1 comment
|
Does this direction look reasonable? If so, I can open a PR. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Realated to https://github.com/unikraft/kraftkit
While reviewing
build_dockerfile, I noticed a TODO-related limitation where Dockerfile detection relies on a filename heuristic instead of validating the file using Dockerfile syntax.Docker does not require a file to be named
Dockerfile.Any file can be used as a Dockerfile via:
So KraftKit behavior diverges from Docker/BuildKit behavior.
Existing capability
The project already includes a proper syntax validator:
Meaning we can reliably detect Dockerfiles using grammar instead of filename heuristics.
Expected behavior
A file should be considered a Dockerfile if it successfully parses as one, regardless of filename.
Suggested direction
Replace filename detection with parser validation:
This aligns KraftKit behavior with Docker and avoids false negatives in CI pipelines and multi-environment setups.
Impact
Question
Was the filename restriction intentional (policy/security), or just a temporary safeguard before syntax validation was added?
All reactions