-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass env vars to docker build #91
Conversation
@drewrobb Fyi, here is an alternative way of passing environment variable moby/moby#2637 (comment) . That said, I prefer your approach. |
@dsKarthick cool trick! |
@drewrobb & @dsKarthick : it may actually be better to use that env file trick to integrate with docker hub. I'm not sure of how the docker hub mechanism works, and it's unclear to me how we'll set these parameters when using docker hub. Maybe they're unneeded. I'm a bit worried that the proposed change here in #91 might not work if we don't have all those variables specified. ... Oh! You can specify a default value:
That should suffice until we can gain a better understanding of the docker hub integration. Maybe @brndnmtthws can speak to that? |
@@ -11,6 +11,10 @@ ENV JAVA_HOME /usr/lib/jvm/java-7-openjdk-amd64 | |||
|
|||
ENV MESOS_NATIVE_JAVA_LIBRARY /usr/lib/libmesos.so | |||
|
|||
ARG MESOS_RELEASE | |||
ARG STORM_RELEASE | |||
ARG MIRROR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are default values set in bin/build-release.sh (since the environment variables are always set to something, so I think it would just be making those values redundantly specified unless I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drewrobb What happens when someone tries to do docker build -t <tag_name>
directly without using the build script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good point, I was thinking people would only invoke build via the build-release.sh script.
@erikdw Good point regarding the default values. |
@drewrobb @erikdw On a second thought, I feel a combination of sourcing technique and @drewrobb's build-arg technique would be better for couple of reasons By combination, I mean the environment variables specified in the env script will have precedence over those we pass with build-arg trick. Docker seems to support conditionals for RUN commands as discussed in this stackoverflow post. Not sure if it does for ARG. Maybe @drewrobb could shed some light on that. |
--build-arg MESOS_RELEASE=$MESOS_RELEASE \ | ||
--build-arg STORM_RELEASE=$STORM_RELEASE \ | ||
--build-arg MIRROR=$MIRROR \ | ||
-t mesos/storm:git-`git rev-parse --short HEAD` ." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might consider using a stock Ubuntu image and installing the correct version of mesos as defined by |
👍 for parameterizing the version. I'm not sure how to make it integrate well with the automated builds on Docker hub, however. |
Ok, so the goals seem to be:
I think we can accomplish both of those with a combination of our ideas from this PR's conversation:
Anyone see any issues with the proposal? .... Oh, I see an issue with @DarinJ 's idea from my naive perspective: it's not clear how we can get the actual mesos deb package name/URL given the mesos version. There are extra bits in the package name and URL. i.e.,
I don't know what |
@erikdw Regarding point 3, what do you think about passing the mesos and storm versions as maven parameters? Currently we grep to figure out mesos and storm versions. Instead we could pass the version we intend to build like |
This feels like it is snowballing a bit. I still think there are fundamental things we need to iron out to fully satisfy the goals as specified above, but it's going to take time to figure out the "right" way to handle the weird suffix thing for the mesos packages. I've asked a question about that on the mesos dev list. So for now in this PR, how about we just do the "ARGS with defaults" thing? (err... of course with the other changes that @drewrobb has made in |
@erikdw Yes. I agree. Right solutions are almost always inversely propotional to quick solutions. |
87de748
to
58ea7bb
Compare
I like this plan. I updated my commit to include defaults (defaults that are consistent with the existing dockerfile, but not pom.xml) |
@drewrobb : that looks good to me, let me test it later tonight or tomorrow morning, I expect I'll just merge it. |
hey @drewrobb : can you please make 1 more change? |
@dsKarthick : I'm fine with @drewrobb : if you update the |
Updated to mesos 0.27.0. I tested default build locally and it worked for me. |
Thanks @drewrobb and others that contributed to the discussion. Merging! |
FYI, I've filed 2 issues for a the unresolved topics that came up in this review:
|
@erikdw fixes #90, although a little bit janky because of repeating variable names 3 times...
Also, perhaps the base image should match MESOS_RELEASE, but that is a separate issue.