Closed ShadowJonathan closed 3 weeks ago
This has always been known, but clearly not documented anywhere. You can't just build the docker image without providing version.txt
. And honestly I didn't know this was something that people were trying to do?
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.
And honestly I didn't know this was something that people were trying to do?
With any and all projects supplying Dockerfile
, it is expected that "Just Running docker build
" will always give it a usable image.
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
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.