We simple want to run sonar-scanner through GitLab CI. We’re building a runner container for this, and building the container gives us an error when we try to install sonnar-scanner-dotnet:
runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
We tried adding “CMD [”/bin/bash"]" to the Dockerfile and it has no effect
DETAILS
To make this efficient, we really need on-demand docker runners. Thus the challenge where we’re stuck trying to build a container to get this to work.
We have a working container for pure Linux, but issue is we have some C# code. The sonar-scanner tool is reporting zero lines in our C# code, and turns out there’s a separate sonar-scanner tool with .NET built-in.
So now we’re trying to setup a Dockerfile that has this sonnar-scanner dotnet version installed. The link above brings me to this command: NuGet Gallery | dotnet-sonarscanner 9.0.2
Since there’s no official sonnar-scanner dotnet on dockerhub, we’re building our own. I’m currently starting with an ubuntu dotnet image here: https://hub.docker.com/r/ubuntu/dotnet-deps
Here’s our Dockerfile so far
FROM ubuntu/dotnet-deps:8.0
#CMD ["/bin/bash"]
RUN dotnet tool install --global dotnet-sonarscanner --version 9.0.2
P.S. Would be nice if SonarSource offered an official sonnar-scanner container that already had .NET built-in. Perhaps I’m missing an easier solution here?