kitchen-docker_cli icon indicating copy to clipboard operation
kitchen-docker_cli copied to clipboard

Make it possible to use custom Dockerfile when setting build_context to true

Open xmik opened this issue 9 years ago • 6 comments

A fix idea for issue: #35 .

This PR provides the change: if custom_dockerfile is set, then it will be rendered using ERB variables and saved to a local file. Then the local file will be passed to docker build command. Then, on kitchen destroy, that rendered Dockerfile is removed.

This is not the prettiest solution, because I didn't change the line: https://github.com/marcy-terui/kitchen-docker_cli/blob/master/lib/kitchen/driver/docker_cli.rb#L87 . Do you think that :input => docker_file could be removed (to avoid duplication)? Or am I missing some clearer and simpler solution?

xmik avatar Sep 01 '16 10:09 xmik

Coverage Status

Changes Unknown when pulling d81a5b06e60ac7edab8fd540fda2f6bad91599ef on xmik:build-context-dockerfile into * on marcy-terui:master*.

coveralls avatar Sep 01 '16 10:09 coveralls

Coverage Status

Changes Unknown when pulling d81a5b06e60ac7edab8fd540fda2f6bad91599ef on xmik:build-context-dockerfile into * on marcy-terui:master*.

coveralls avatar Sep 01 '16 10:09 coveralls

Coverage Status

Changes Unknown when pulling d81a5b06e60ac7edab8fd540fda2f6bad91599ef on xmik:build-context-dockerfile into * on marcy-terui:master*.

coveralls avatar Sep 01 '16 10:09 coveralls

Coverage Status

Changes Unknown when pulling d81a5b06e60ac7edab8fd540fda2f6bad91599ef on xmik:build-context-dockerfile into * on marcy-terui:master*.

coveralls avatar Sep 01 '16 10:09 coveralls

I came up with acceptable fix now. If build_context is false, then there is no behavior change. But, if build_context is set to true, then Dockerfile contents is saved to a file and passed to docker build command with -f option.

Edit: I think you'd want me to squash the commits?

xmik avatar Sep 01 '16 10:09 xmik

Coverage Status

Changes Unknown when pulling 5549ee19de99ed0ab543eb1d553eb97838dbab20 on xmik:build-context-dockerfile into * on marcy-terui:master*.

coveralls avatar Sep 01 '16 10:09 coveralls