2014-11-23 20:46:18 +00:00
|
|
|
FROM debian:squeeze
|
|
|
|
MAINTAINER Jakob Borg <jakob@nym.se>
|
|
|
|
|
2015-01-16 09:18:54 +00:00
|
|
|
ENV GOLANG_VERSION 1.4.1
|
2014-11-19 11:02:47 +00:00
|
|
|
|
|
|
|
# SCMs for "go get", gcc for cgo
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
ca-certificates curl gcc libc6-dev make \
|
2014-12-13 09:38:05 +00:00
|
|
|
bzr git mercurial unzip patch \
|
2014-11-19 11:02:47 +00:00
|
|
|
--no-install-recommends \
|
2014-11-23 20:46:18 +00:00
|
|
|
&& apt-get clean \
|
2014-11-19 11:02:47 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Get the binary dist of Go to be able to bootstrap gonative.
|
|
|
|
|
2014-11-23 20:46:18 +00:00
|
|
|
RUN curl -sSL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz \
|
2014-11-19 11:02:47 +00:00
|
|
|
| tar -v -C /usr/local -xz
|
|
|
|
|
|
|
|
ENV PATH /usr/local/go/bin:$PATH
|
|
|
|
ENV GOPATH /go
|
2015-01-09 09:21:30 +00:00
|
|
|
ENV GO386 387
|
|
|
|
ENV GOARM 5
|
2014-11-19 11:02:47 +00:00
|
|
|
ENV PATH /go/bin:$PATH
|
2015-01-09 09:21:30 +00:00
|
|
|
|
|
|
|
RUN mkdir /go
|
2014-11-19 11:02:47 +00:00
|
|
|
WORKDIR /go
|
|
|
|
|
|
|
|
# Use gonative to install native Go for most arch/OS combos
|
|
|
|
|
2014-11-23 20:46:18 +00:00
|
|
|
RUN go get github.com/calmh/gonative \
|
|
|
|
&& cd /usr/local \
|
2014-11-19 11:02:47 +00:00
|
|
|
&& rm -rf go \
|
|
|
|
&& gonative -version $GOLANG_VERSION
|
|
|
|
|
2014-12-13 09:38:05 +00:00
|
|
|
# Rebuild the special and missing versions, using patches as appropriate
|
|
|
|
|
2015-01-16 09:18:54 +00:00
|
|
|
# RUN mkdir /tmp/patches
|
|
|
|
# ADD *.patch /tmp/patches/
|
|
|
|
# RUN bash -xec '\
|
|
|
|
# cd /usr/local/go ; \
|
|
|
|
# for patch in /tmp/patches/*.patch ; do \
|
|
|
|
# patch -p0 < "$patch" ; \
|
|
|
|
# done \
|
|
|
|
# '
|
2014-11-19 11:02:47 +00:00
|
|
|
|
|
|
|
RUN bash -xec '\
|
|
|
|
cd /usr/local/go/src; \
|
|
|
|
for platform in linux/386 freebsd/386 windows/386 linux/arm openbsd/amd64 openbsd/386; do \
|
|
|
|
GOOS=${platform%/*} \
|
|
|
|
GOARCH=${platform##*/} \
|
|
|
|
CGO_ENABLED=0 \
|
|
|
|
./make.bash --no-clean 2>&1; \
|
|
|
|
done \
|
2014-11-23 20:46:18 +00:00
|
|
|
&& ./make.bash --no-clean \
|
2014-11-19 11:02:47 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
# Install packages needed for test coverage
|
|
|
|
|
2014-11-23 20:46:18 +00:00
|
|
|
RUN go get github.com/tools/godep \
|
2014-11-29 19:44:09 +00:00
|
|
|
&& go get golang.org/x/tools/cmd/cover \
|
2014-11-23 20:46:18 +00:00
|
|
|
&& go get github.com/axw/gocov/gocov \
|
|
|
|
&& go get github.com/AlekSi/gocov-xml
|
2014-11-19 11:02:47 +00:00
|
|
|
|
2014-12-08 15:10:29 +00:00
|
|
|
# Install tools "go vet" and "golint"
|
|
|
|
|
|
|
|
RUN go get golang.org/x/tools/cmd/vet \
|
|
|
|
&& go get github.com/golang/lint/golint
|
|
|
|
|
2014-11-29 23:30:23 +00:00
|
|
|
# Build standard library for race
|
|
|
|
|
|
|
|
RUN go install -race std
|
|
|
|
|
2014-11-23 21:30:29 +00:00
|
|
|
# Random build users needs to be able to create stuff in /go
|
|
|
|
|
|
|
|
RUN chmod -R 777 /go/bin /go/pkg /go/src
|