Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

DockerBuildPlugin should obey envVars #281

Closed
ckarenz opened this issue Feb 28, 2017 · 0 comments
Closed

DockerBuildPlugin should obey envVars #281

ckarenz opened this issue Feb 28, 2017 · 0 comments
Assignees

Comments

@ckarenz
Copy link
Contributor

ckarenz commented Feb 28, 2017

I have code like the following in my web service's build.sbt, so I can define the port in one place:

containerPort := 8087 // For jetty:start
dockerPorts += containerPort.value // For dockerRun
envVars += ("PORT" -> containerPort.value.toString) // For run

Later, in code, I have:

sys.env.get("PORT").map(_.toInt).getOrElse(8080)

And finally, I need a duplicate directive in the Dockerfile to ensure the service binds itself to the correct port when running in a container:

ENV PORT 8087

I'd very much like envVars to get picked up by the docker plugin, similarly to javaOptions. This would allow me to avoid the duplication in our Dockerfile.

jkinkead pushed a commit to jkinkead/sbt-plugins that referenced this issue Mar 1, 2017
This works with environment variable names that don't use punctuation; double-quotes and other items
may cause errors. Please stick to [A-Za-z_].

Fixes allenai#281 .
jkinkead added a commit that referenced this issue Mar 1, 2017
This works with environment variable names that don't use punctuation; double-quotes and other items
may cause errors. Please stick to [A-Za-z_].

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

No branches or pull requests

2 participants