Review config for cmd/entrypoint after building a stage

As mentioned in #346, if only ENTRYPOINT is set in a stage then any
CMD inherited from a parent should be cleared.

If both entrypoint and cmd are set then nothing should change.

I added a function and unit test to review the config file after building a stage
which clears out config.Cmd if ENTRYPOINT was declared but CMD wasn't.

I also added an integration test to make sure this works, which should
be tested by the preexisting container-diff --metadata test.
This commit is contained in:
Priya Wadhwa
2018-09-10 18:15:51 -07:00
parent 4dc34343b6
commit 5d2d2829d0
3 changed files with 105 additions and 0 deletions
@@ -0,0 +1,5 @@
FROM scratch AS first
CMD ["mycmd"]
FROM first
ENTRYPOINT ["myentrypoint"] # This should clear out CMD in the config metadata