datawire / forge

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

Conditionally build a different Dockerfile for the same service #144

Open majelbstoat opened 6 years ago

majelbstoat commented 6 years ago

When developing, I want to use a VOL command in my Dockerfile which I can bind to a hostPath at runtime, so I can work with hot-reloading.

When deploying, I want to use a COPY command that copies the code across to be compiled.

I'd love to use the same forge deploy command for both environments.

It doesn't currently seem to be possible to do this, without specifying multiple Dockerfiles per service, and then hacking service.yaml to create a service-a-dev, service-a-prod definitions, which seems to defeat the purpose of profiles.

Supporting templatised Dockerfiles in the same manner as templatised kubernetes manifests would allow this to work.

(An alternative would be interpolation in the container path, so we could use specify a single service in service.yaml and build either /dev/Dockerfile or /prod/Dockerfile. But consistency with how k8s is configured seems nicer.)