Dockerfile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. FROM debian:squeeze
  2. MAINTAINER Jakob Borg <[email protected]>
  3. ENV GOLANG_VERSION 1.4
  4. # SCMs for "go get", gcc for cgo
  5. RUN apt-get update && apt-get install -y \
  6. ca-certificates curl gcc libc6-dev make \
  7. bzr git mercurial unzip patch \
  8. --no-install-recommends \
  9. && apt-get clean \
  10. && rm -rf /var/lib/apt/lists/*
  11. # Get the binary dist of Go to be able to bootstrap gonative.
  12. RUN curl -sSL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz \
  13. | tar -v -C /usr/local -xz
  14. ENV PATH /usr/local/go/bin:$PATH
  15. RUN mkdir /go
  16. ENV GOPATH /go
  17. ENV PATH /go/bin:$PATH
  18. WORKDIR /go
  19. # Use gonative to install native Go for most arch/OS combos
  20. RUN go get github.com/calmh/gonative \
  21. && cd /usr/local \
  22. && rm -rf go \
  23. && gonative -version $GOLANG_VERSION
  24. # Rebuild the special and missing versions, using patches as appropriate
  25. RUN mkdir /tmp/patches
  26. ADD *.patch /tmp/patches/
  27. RUN bash -xec '\
  28. cd /usr/local/go ; \
  29. for patch in /tmp/patches/*.patch ; do \
  30. patch -p0 < "$patch" ; \
  31. done \
  32. '
  33. RUN bash -xec '\
  34. cd /usr/local/go/src; \
  35. for platform in linux/386 freebsd/386 windows/386 linux/arm openbsd/amd64 openbsd/386; do \
  36. GOOS=${platform%/*} \
  37. GOARCH=${platform##*/} \
  38. GOARM=5 \
  39. GO386=387 \
  40. CGO_ENABLED=0 \
  41. ./make.bash --no-clean 2>&1; \
  42. done \
  43. && ./make.bash --no-clean \
  44. '
  45. # Install packages needed for test coverage
  46. RUN go get github.com/tools/godep \
  47. && go get golang.org/x/tools/cmd/cover \
  48. && go get github.com/axw/gocov/gocov \
  49. && go get github.com/AlekSi/gocov-xml
  50. # Install tools "go vet" and "golint"
  51. RUN go get golang.org/x/tools/cmd/vet \
  52. && go get github.com/golang/lint/golint
  53. # Build standard library for race
  54. RUN go install -race std
  55. # Random build users needs to be able to create stuff in /go
  56. RUN chmod -R 777 /go/bin /go/pkg /go/src