Improve docker image and build

This commit is contained in:
Jakob Borg 2014-11-23 21:46:18 +01:00
parent fe2ae4c6c3
commit 1db120bf06
2 changed files with 19 additions and 17 deletions

View File

@ -2,7 +2,7 @@
set -euo pipefail
IFS=$'\n\t'
DOCKERIMGV=1.3.3-1
DOCKERIMGV=1.3.3-2
case "${1:-default}" in
default)
@ -108,12 +108,12 @@ case "${1:-default}" in
docker build -q -t syncthing/build:$DOCKERIMGV docker
;;
docker)
docker-all)
docker run --rm -h syncthing-builder -u $(id -u) -t \
-v $(pwd):/go/src/github.com/syncthing/syncthing \
-w /go/src/github.com/syncthing/syncthing \
syncthing/build:$DOCKERIMGV \
sh -c './build.sh clean && ./build.sh && STTRACE=all ./build.sh test-cov && ./build.sh all'
sh -c './build.sh clean && STTRACE=all ./build.sh test-cov && ./build.sh all'
;;
*)

View File

@ -1,17 +1,19 @@
FROM debian:jessie
FROM debian:squeeze
MAINTAINER Jakob Borg <jakob@nym.se>
ENV GOLANG_VERSION 1.3.3
# 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 \
--no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
ENV GOLANG_VERSION 1.3.3
# Get the binary dist of Go to be able to bootstrap gonative.
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz \
RUN curl -sSL https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz \
| tar -v -C /usr/local -xz
ENV PATH /usr/local/go/bin:$PATH
@ -22,14 +24,15 @@ WORKDIR /go
# Use gonative to install native Go for most arch/OS combos
RUN go get github.com/calmh/gonative
RUN cd /usr/local \
RUN go get github.com/calmh/gonative \
&& cd /usr/local \
&& rm -rf go \
&& gonative -version $GOLANG_VERSION
# Random build users needs to be able to create stuff in /go/pkg
# Random build users needs to be able to create stuff in /go
RUN chmod -R 777 /go/pkg
RUN rm -rf /go/pkg \
&& chmod 777 /go
# Rebuild the special and missing versions
@ -43,14 +46,13 @@ RUN bash -xec '\
CGO_ENABLED=0 \
./make.bash --no-clean 2>&1; \
done \
&& ./make.bash --no-clean \
'
# And rebuild native without the flags above
RUN cd /usr/local/go/src \
&& ./make.bash --no-clean
# Install packages needed for test coverage
RUN go get github.com/tools/godep && go get code.google.com/p/go.tools/cmd/cover && go get github.com/axw/gocov/gocov && go get github.com/AlekSi/gocov-xml
RUN go get github.com/tools/godep \
&& go get code.google.com/p/go.tools/cmd/cover \
&& go get github.com/axw/gocov/gocov \
&& go get github.com/AlekSi/gocov-xml