-
Notifications
You must be signed in to change notification settings - Fork 14
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
Running docker build
without supplying version.txt
in the repo will fail because git
isnt in the image
#300
Comments
This has always been known, but clearly not documented anywhere. You can't just build the docker image without providing |
I'm not a system admin so i would be interested to know what you recommend. Since we want the version to be provided, but also don't want to install git in the image just to be able to describe the version (although it could be removed as part of the build process? idk) |
You could possibly attach another build step which downloads a minimal git image, grabs and outputs the version, and then passes it on to the next stage? The way the dockerfile is currently constructed, adding it to the last stage would add it to the final image, but having a 'builder' pre-step like that would not have it stay in the final image.
With any and all projects supplying |
We never supported doing so, but I can understand how it might be seen that we have entered an implicit contract. I assume that by another build step and stage you are referring to what is described in the documentation here? That's pretty cool, I don't know why we didn't use this before or seemingly not realise that this is something that we can do. |
Yes, multi-stage builds are awesome. You can use a fully-fledged build environment to compile your code, and then just copy the binary to a minimal execution environment, and trim down on the final image size like that. Here, it can be done to inspect the current git repository from one stage, and then hand the result to the next :3 In any case, clarifying the error and/or possibly halting when it sees that the required environment variable is missing would go a long way in explaining why the build failed. |
@ShadowJonathan I've given this a go in #595 if you'd like to take a look <3 |
* Use multi-stage build in Dockerfile #300. * Move git describe and build into one stage. Probably won't be a good idea to download an alpine image just to install git. * Remove git describe step from CI. * whoopsie, copy version from the build stage not the deleted stamp.
I encountered this while doing some development and building the image on my VM; Doing a bare clone and then running
docker build
immediately will fail with something like this;This isn't noticed in the Github Actions Flow because there the file is always given, and the step in
yarn build
where it attempts to get it is skipped.The text was updated successfully, but these errors were encountered: