Last active
December 24, 2019 12:52
-
-
Save NewbMiao/f4340b483e3dfc057911cba8e7a37562 to your computer and use it in GitHub Desktop.
Cmd to run gotrace tool that compiled by go1.8. (docker pull newbmiao/gotrace1.8)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM divan/golang:gotrace | |
RUN go get -u github.com/divan/gotrace && cd $GOPATH/src/github.com/divan/gotrace && git checkout go18 && go install | |
RUN mv /go/bin/gotrace /usr/local/bin | |
EXPOSE 2000 | |
ENTRYPOINT ["gotrace"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOCKERPATH="https://git.io/JeQQM" #https://gist.github.com/NewbMiao/f4340b483e3dfc057911cba8e7a37562#file-dockerfile | |
IMAGETAG="divan/golang:gotrace1.8" | |
if [ $# -eq 0 ]; then | |
echo -e "Usage: Require go file pathname(some code enable trace goroutines)\n\ | |
Shell : sh gotrace.sh goroutines.go" | |
exit; | |
fi | |
exist=$(docker images|grep gotrace1.8|wc -l) | |
if [ $exist -eq 0 ]; then | |
echo "build image $IMAGETAG" | |
{ | |
workspace=$(cd $(dirname $0) && pwd -P) | |
cd $workspace | |
if [ ! -f "Dockerfile" ]; then | |
curl -o Dockerfile "$DOCKERPATH" | |
fi | |
docker build . -t $IMAGETAG | |
} | |
fi | |
docker run --rm -it -p 2000:2000 -v $PWD:/go $IMAGETAG $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment