datawire / forge

Define and run multi-container apps in Kubernetes
http://forge.sh
Apache License 2.0
416 stars 43 forks source link

Ability to tag metadata to the docker image #42

Open makeittotop opened 7 years ago

makeittotop commented 7 years ago

Not sure if there is already an option to hand-craft the docker image build name with chosen metadata (example: deployment 'track', version etc) in which case this is probably not needed.

Else it'd be good to differentiate between different images to help perform certain administrative actions.

rhs commented 7 years ago

There isn't any such ability currently, but we could certainly add some flexibility here.

The way forge works depends on being able to deterministically compute the image name based on a hash of all the input sources. You can think of this as an automatically computed "implementation version" (as opposed to a semantic API version). This hash needs to be part of the image name in order for forge to be able to cache docker builds, but we could certainly have a component of the image name that is customizable.

I could also add the ability to add custom labels to docker images. That might be a good place to put some of that information as well.

tristanpemble commented 7 years ago

This is, now that I think about it, kind of increasingly important now that #33 is implemented. Now that you can change the build config depending on environment variables, you can end up with different images with the same project checksum.

Maybe something like:

containers:
  - dockerfile: ./Dockerfile
    tag: {{version}}{%if env.DEBUG %}-debug{% endif %}

With a validation that {{version}} is included in the tag