how to compile golang project with docker container? I want to compile and retrieve the project build, using docker cli
sample docker command
docker run -v $(pwd)/:/app -w /app -v $SSH_AUTH_SOCK:/tmp/ssh_auth.sock -e SSH_AUTH_SOCK=/tmp/ssh_auth.sock --name golanguser golang:1.17 sh -c "export GOPRIVATE=https://user:pass@bitbucket.org/repo/ && go build -o main bitbucket.org/repo/source"
go buildcreates an executable for your project, it doesn't run your code. Either call your executable after you built it, orgo run. Note this doesn't create an optimized build. The best solution would be to have a Dockerfile directly in your repository, and build it from here (instead of fetching your code from bitbucket in the docker image).