Skip to content

Instantly share code, notes, and snippets.

@Dreamacro
Last active January 22, 2022 08:37
Show Gist options
  • Save Dreamacro/3a1b7b17e55d6917d05775091b1a8669 to your computer and use it in GitHub Desktop.
Save Dreamacro/3a1b7b17e55d6917d05775091b1a8669 to your computer and use it in GitHub Desktop.
A simple docker image and shell function for pprof
gopprof() {
echo $1 $2 $#
if [ "$1" = "ui" ]; then
docker run --rm -w `pwd` -v `pwd`:/where/your/ci/path -p 8081:8081 -it pprof go tool pprof -http="0.0.0.0:8081" "http://$2:6060/debug/pprof/heap"
else
docker run --rm -w `pwd` -v `pwd`:/where/your/ci/path -it pprof go tool pprof "http://$1:6060/debug/pprof/heap"
fi
}
FROM golang:alpine
# remove mirror repository if you don't need it
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
apk add --no-cache graphviz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment