Skip to content

Instantly share code, notes, and snippets.

@stuart-warren
Created October 24, 2014 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuart-warren/cb878470ae508c80632a to your computer and use it in GitHub Desktop.
Save stuart-warren/cb878470ae508c80632a to your computer and use it in GitHub Desktop.
Build go apps without installing go (needs more testing)
FROM ubuntu:latest
## Run with:
# docker build -t golang .
# export GOPATH=/home/user.name/gostuff
# alias go='docker run -ti -v ${GOPATH}:${GOPATH} -e GOPATH=${GOPATH} -w ${PWD} golang'
# alias gofmt='docker run -ti -v ${GOPATH}:${GOPATH} -e GOPATH=${GOPATH} -w ${PWD} --entrypoint=/go/bin/gofmt golang'
# alias godoc='docker run -ti -v ${GOPATH}:${GOPATH} -e GOPATH=${GOPATH} -w ${PWD} --entrypoint=/go/bin/godoc golang'
# cd /project/within/GOPATH
# go get github.com/gin-gonic/gin
RUN apt-get update && apt-get install -y git mercurial
ADD https://storage.googleapis.com/golang/go1.3.3.linux-amd64.tar.gz /
RUN tar -xzf /go1.3.3.linux-amd64.tar.gz
VOLUME ["/home/vagrant/go"]
ENV GOPATH /home/vagrant/go
ENV GOROOT /go
ENTRYPOINT ["/go/bin/go"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment