src-d / enry

A faster file programming language detector
https://blog.sourced.tech/post/enry/
Apache License 2.0
460 stars 51 forks source link

Make build not working in golang:alpine container #231

Closed rafaveira3 closed 5 years ago

rafaveira3 commented 5 years ago

I would like to build enry via Makefile to get the command enry --version work properly. However, when building it inside a golang:alpine container, I keep having the following issues:

$ docker run -it golang:alpine
/go # apk update && apk upgrade
...
/go # apk add --no-cache alpine-sdk git make
...
/go # git clone https://github.com/src-d/enry.git code && cd code && make build
Cloning into 'code'...
remote: Enumerating objects: 161, done.
remote: Counting objects: 100% (161/161), done.
remote: Compressing objects: 100% (107/107), done.
remote: Total 2307 (delta 55), reused 121 (delta 51), pack-reused 2146
Receiving objects: 100% (2307/2307), 7.71 MiB | 3.22 MiB/s, done.
Resolving deltas: 100% (1242/1242), done.
git clone --quiet --depth 1 https://github.com/src-d/docs /go/code/.docsrv-resources/.docs;
git clone --quiet --depth 1 -b v1 https://github.com/src-d/ci.git .ci;
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
git clone --quiet --depth 1 https://github.com/src-d/docs /.docsrv-resources/.docs;
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: /bin/bash: Command not found
make: *** [.ci/Makefile.main:158: cmd/enry] Error 127
/go/code #

Can someone guide me on how to overcome this? 🙃

creachadair commented 5 years ago

It looks like we have hard-coded /bin/bash in a some of the subdirectory Makefiles. Possibly we should try not to do that, but for now I would suggest you add apk add --no-cache bash to your setup.

bzz commented 5 years ago

Yup, @creachadair is absolutely right - adding that should allow for our CI makefile to stop failing due to bash command missing.

@rafaveira3 that is what I did locally and it seems to work:

$ docker run -it golang:alpine
$ apk add --no-cache git make bash
$ git clone https://github.com/src-d/enry.git
$ cd enry; make packages
$ ./build/enry_linux_amd64/enry
98.34%  Go
0.97%   C
0.31%   Shell
0.21%   Java
0.07%   Ruby
0.05%   Makefile
0.04%   Scala
0.01%   Gnuplot

Going to close this issue if there is no further questions. But please feel free to re-open it in case something is still not working.

rafaveira3 commented 5 years ago

Thanks for the help, @bzz and @creachadair! It worked! 🙃