FactomProject / factomd

Factom Daemon
https://www.factomprotocol.org/
Other
201 stars 92 forks source link

build/versioning issue with docker-compose setup #1122

Open sigrlami opened 3 years ago

sigrlami commented 3 years ago

When building from sources in docker-compose it fails to properly resolve git tags and attach correct version value; this happened due to this change https://github.com/FactomProject/factomd/blame/328a1ea51a992ed2b58e1ad7d9043b2d9a9457b8/Makefile#L1 and not noticeable if the image built locally or on CI with direct access to git.

Docker context functionality just gets a folder with the source without any additional information from git, so simple setup like

version: "3"
services:
##################################################################################
    factomd:
    build:
            context: https://github.com/FactomProject/factomd.git
            dockerfile: Dockerfile.alpine

lead to an error while make install

Step 5/14 : RUN make install
 ---> Running in a234e9ef8600
fatal: No names found, cannot describe anything.
Make factomd 
fatal: No names found, cannot describe anything.

which is correct since no git data available. This can be solved if at least the latest tag exists in context before make inside Dockerfile but doing

RUN git fetch --unshallow

quite time-consuming, and probably not the best option here. So there are 2 options, avoid using git describe on top of make file or extend Dockerfile to fetch git data.

I'm not sure how that affects the build pipeline for CI and images but I can create a patch.

sigrlami commented 3 years ago

Also, affects develop branch when someone runs an isolated build for whatever development reasons within docker-compose and raw git build, as tags not there.