Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Way to remove build tooling. #46

Open
schancel opened this issue Nov 14, 2016 · 2 comments
Open

Way to remove build tooling. #46

schancel opened this issue Nov 14, 2016 · 2 comments

Comments

@schancel
Copy link

Many containers build code in some fashion during their construction. However, for convenience reasons build tools are often left inside the resulting container image. This is not ideal. It would be nice if box provided a convenient way to remove the excess layers.

Some ways of accomplishing this that I can see are:

  1. Build an artifact in one container but move that layer to be based on a different image at the end -- effectively omitting intermediate layers.
  2. Allow a way to flatten an image with a whitelist directory. E.g. "Flatten all these layers, and only keep files from this particular directory."
  3. Allow some layers to be specified as ephemeral. These layers could be removed at the end of a build with parents relinked appropriately by box.
@erikh
Copy link
Member

erikh commented Nov 14, 2016

https://github.com/erikh/box/blob/master/image/image.go is a start at creating a position-independent layer management system for docker images; once this is fleshed out a bit more I think a lot of this stuff gets easier.

Thinking purely about the language used to describe this, this could preserve all files specified in the glob after the build instructions inside the block complete. Is this what you're after?

artifact "/tmp/**/*.go" do
  copy "sourcecode", "builddir"
  inside "builddir" do
    run "some build stuff"
  end
end

@erikh
Copy link
Member

erikh commented Dec 3, 2016

@schancel did you ever get a chance to look at this yet? We added a skip function which does most of what you're describing here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants