Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kshailen/8b46417e1a2cd6e9dee42fc13e142cc7 to your computer and use it in GitHub Desktop.
Save kshailen/8b46417e1a2cd6e9dee42fc13e142cc7 to your computer and use it in GitHub Desktop.
Building a docker which has go language , benchmark tool , hey and bech.sh
#Go to the directory where you have put this docker file.
cd <Path to the DockerFile>
# Run following to build an docker image
docker build -t go-container .
#Check image by using docker images. It will show like this.
shailendra-kumar:Docker shailendra.kumar$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
go-container latest 345201290fde 6 minutes ago 886MB
<none> <none> e55c5bb88b1a 12 minutes ago 886MB
<none> <none> eca1ff37636a 21 minutes ago 871MB
<none> <none> d4f4f516d8ee 41 minutes ago 699MB
<none> <none> 0acd2e795ec6 About an hour ago 699MB
golang 1.8 41e7847de71b 11 days ago 699MB
ubuntu latest 7b9b13f7b9c0 2 weeks ago 118MB
hello-world latest 48b5124b2768 5 months ago 1.84kB
shailendra-kumar:Docker shailendra.kumar$
#Run Following to launch container and connect
docker run --rm -it go-container bash
FROM golang:1.8
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN export PATH="/usr/local/go/bin:$PATH";\
go version
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH/src
# Installing bechmark tool
RUN go get github.com/coreos/etcd/tools/benchmark
WORKDIR $GOPATH/src/github.com/coreos/etcd/tools/benchmark
RUN go build -o benchmark
#Checking if benchmark is installed
RUN benchmark -h
# Installing hey tool
WORKDIR $GOPATH/src
RUN go get github.com/rakyll/hey
WORKDIR $GOPATH/src/github.com/rakyll/hey
RUN go build -o hey
WORKDIR $GOPATH/src/github.com/coreos/etcd/hack/benchmark
# Installing vi editor, it won't be there by default
RUN apt-get update
RUN apt-get install vim -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment