syncthing/docker/Dockerfile

76 lines
1.9 KiB
Docker
Raw Normal View History

2014-11-23 21:46:18 +01:00
FROM debian:squeeze
MAINTAINER Jakob Borg <jakob@nym.se>
2014-12-11 12:48:40 +01:00
ENV GOLANG_VERSION 1.4
2014-11-19 12:02:47 +01: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 12:02:47 +01:00
--no-install-recommends \
2014-11-23 21:46:18 +01:00
&& apt-get clean \
2014-11-19 12:02:47 +01:00
&& rm -rf /var/lib/apt/lists/*
# Get the binary dist of Go to be able to bootstrap gonative.
2014-11-23 21:46:18 +01:00
RUN curl -sSL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz \
2014-11-19 12:02:47 +01:00
| tar -v -C /usr/local -xz
ENV PATH /usr/local/go/bin:$PATH
ENV GOPATH /go
ENV GO386 387
ENV GOARM 5
2014-11-19 12:02:47 +01:00
ENV PATH /go/bin:$PATH
RUN mkdir /go
2014-11-19 12:02:47 +01:00
WORKDIR /go
# Use gonative to install native Go for most arch/OS combos
2014-11-23 21:46:18 +01:00
RUN go get github.com/calmh/gonative \
&& cd /usr/local \
2014-11-19 12:02:47 +01: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 12:02:47 +01: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 21:46:18 +01:00
&& ./make.bash --no-clean \
2014-11-19 12:02:47 +01:00
'
# Install packages needed for test coverage
2014-11-23 21:46:18 +01:00
RUN go get github.com/tools/godep \
&& go get golang.org/x/tools/cmd/cover \
2014-11-23 21:46:18 +01:00
&& go get github.com/axw/gocov/gocov \
&& go get github.com/AlekSi/gocov-xml
2014-11-19 12:02:47 +01:00
2014-12-08 16:10:29 +01: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-30 00:30:23 +01:00
# Build standard library for race
RUN go install -race std
2014-11-23 22:30:29 +01:00
# Random build users needs to be able to create stuff in /go
RUN chmod -R 777 /go/bin /go/pkg /go/src