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
Add hint to keep version of node and meteor flexible #30
Comments
So https://github.com/disney/meteor-base/blob/master/src/Dockerfile already has Therefore I assume you’re talking about https://github.com/disney/meteor-base/blob/master/example/default.dockerfile, which is meant as example boilerplate for users to use in their own projects. So sure, we can at least put a comment in this file along the lines of “if you don’t want to hard-code the Meteor version, uncomment the next line”. I would be hesitant to make the So at the very least I’m fine with adding a comment and/or a note in the README, and I’m open to discussing any ways to further automate this; but I want to avoid users needing to use scripts to build, because that adds complexity and makes us need to figure out how to make that cross-platform (since I don’t want to exclude Windows users). Also something else to be aware of is that the example |
Yes, adding a comment to the sample is all I'm asking for here. It's just to show the possibility. Well ... I now also have to move away from it because I want to use docker hub and automated builds there and I haven't found a way to support it. But it could be a nice tweak for others, so I thought it would be good to mention it. |
I've just written a build-script which allows you to 1. not use a lot of additional resources and 2. take the version numbers from the project itself. Here it is: #!/bin/bash
METEOR_VERSION=$(cat ./.meteor/release | cut -c8-99)
NODE_VERSION=$(docker run --rm geoffreybooth/meteor-base:${METEOR_VERSION} meteor node --version | cut -c2-99 | grep -o "[0-9\.]*")
docker build --build-arg METEOR_VERSION=$METEOR_VERSION --build-arg NODE_VERSION=$NODE_VERSION . Since this is a separate script (which I use on DockerHub because it allows to overwrite the build script) - where should I add this as a good flexible version? |
I am now planning on moving my own build script to using this package as multi stage build, and I found a neat trick in my script which might be cool to share to the users of this script.
When running my script, I have a docker-variable for the name of the base-image, which is filled with the value used in my current environment. Let me put this into an example.
In the environment of my project, I have a clear reference what version of meteor and nodejs I'm using.
A call of
meteor node --version | cut -c2-99
reveals the version of nodejs andmeteor --version | cut -c8-99
reveals the version of meteor.So why not propose to start the build-script with:
And call
docker build --build-arg NODE_VERSION=$(meteor node --version | cut -c2-99) --build-arg METEOR_VERSION=$(meteor --version | cut -c8-99)
and use them in the multi stage build script? It's just a very neat trick, I think, people should get to know of.But I sadly have to drop it since I cannot get a docker-build argument being passed on by another build-step. This means I cannot have a docker file which you just run and it will figure all this out 😢 Maybe it helps someone leaving it as a hint.
EDIT: Fixed the example of a
Dockerfile
file according to moby/moby#37345 (comment). Variables which I want to have available in all steps must be declared before the firstFROM
definition.The text was updated successfully, but these errors were encountered: