syncthing/docker/Dockerfile

75 lines
2.0 KiB
Docker
Raw Normal View History

2014-11-23 20:46:18 +00:00
FROM debian:squeeze
MAINTAINER Jakob Borg <jakob@nym.se>
2014-12-11 11:48:40 +00:00
ENV GOLANG_VERSION 1.4
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 \
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
RUN mkdir /go
ENV GOPATH /go
ENV PATH /go/bin:$PATH
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
# Rebuild the special and missing versions, using patches as appropriate
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##*/} \
GOARM=5 \
GO386=387 \
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 \
&& 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