You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user of scc in containers will run into issues with running the application in alpine if they do not use compiler flag CGO_ENABLED=0.
So I was trying to run scc in a pipeline, and saw iRyanBell's implementation from your README, but I couldn't find the image; I just built my own (mjuul/scc). (I did find the image later: https://github.com/marketplace/actions/scc-docker-action -- I thought it was on docker hub).
But I ran into several issues, firstly with go get where it seems impossible to install v2.13.0 (see my description here: golang/go#35732) well... so I decided to compile it myself and I wrote the Dockerfile below
FROM golang as scc-get
ENV GOOS=linux \
GOARCH=amd64
ARG VERSION
RUN git clone --branch $VERSION --depth 1 https://github.com/boyter/scc
WORKDIR /go/scc
RUN go build -ldflags="-s -w"FROM alpine
COPY --from=scc-get /go/scc/scc /bin/
ENTRYPOINT ["scc"]
You get an error: standard_init_linux.go:211: exec user process caused "no such file or directory"
So I noted that iRyanBell is running the i386 (32 bit) vers. succesfully (which he didn't have to anyway). And that also works. (setting ENV GOARCH=386).
But that is very unsatisfactory; I certainly expect the program to run with the expected behavior on the same architecture.
Alpine images... the bane of my existence when doing anything in Go. The amount of times I have had the same issue... well its not a huge amount but enough that its etched into my brain.
If you want to write the documentation into the README ill merge it in and you get the credit :)
Otherwise ill add this in in a week or two. Cheers.
* Update README.md
* SLOCCount came before cloc
* resolveboyter#206
* First cut at boyter#210
* Add "gohtml" and "gotxt" to the list of extensions for Go templates
These are the default extensions that e.g. GoLand uses, and some other
tools as well I believe. It's useful as it disambiguates between
templates for html/template and text/template.
* partial fix for boyter#214
* resolve after feedback
* Mostly ready for boyter#211
* real fix for issue214
* few tests and typo
* Resolvehttps://github.com/boyter/issues/208
* Update to remove wrong Go version mentioned boyter#220
Co-authored-by: Ben Boyter <boyter@users.noreply.github.com>
Co-authored-by: AlDanial <al.danial@gmail.com>
Co-authored-by: Ben Boyter <ben@boyter.org>
Co-authored-by: Martin Tournoij <martin@arp242.net>
A user of scc in containers will run into issues with running the application in alpine if they do not use compiler flag
CGO_ENABLED=0
.So I was trying to run scc in a pipeline, and saw iRyanBell's implementation from your README, but I couldn't find the image; I just built my own (mjuul/scc). (I did find the image later: https://github.com/marketplace/actions/scc-docker-action -- I thought it was on docker hub).
But I ran into several issues, firstly with
go get
where it seems impossible to install v2.13.0 (see my description here: golang/go#35732) well... so I decided to compile it myself and I wrote the Dockerfile belowthen
$ docker build -t scc-image --build-arg VERSION=v2.13.0 . $ docker run -v /some/local/path/:/root/something -w /root/something scc-image
You get an error:
standard_init_linux.go:211: exec user process caused "no such file or directory"
So I noted that iRyanBell is running the i386 (32 bit) vers. succesfully (which he didn't have to anyway). And that also works. (setting
ENV GOARCH=386
).But that is very unsatisfactory; I certainly expect the program to run with the expected behavior on the same architecture.
Searching around I find: https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host
and that fixes the issue.
i.e. this works:
So the documentation should mention compiler flag
CGO_ENABLED=0
for better compatibility with less dynamic linking.The text was updated successfully, but these errors were encountered: