From 162b056784b3bfc11ed3fde11f0e055ef736911a Mon Sep 17 00:00:00 2001 From: David Wragg Date: Fri, 10 Apr 2015 12:45:27 +0100 Subject: [PATCH] Docker needs golang 1.4.2 to build, so we do too --- build/Dockerfile | 11 ++++++++++- build/build.sh | 2 +- site/building.md | 19 ++++++++++++------- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 46b584bc..562673c8 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,12 +1,21 @@ FROM ubuntu +RUN apt-get -y update && apt-get -y install --no-install-recommends build-essential git ca-certificates docker.io mercurial libpcap-dev curl make pkg-config gcc bison flex + # When doing a build in a container, "apt-get update" happens twice, # which can be a very significant overhead for incremental builds. # And it's unnecessary, because if any of the prerequisites do change, # the right thing to do is to rebuild the container image. Rather # than suppressing the "apt-get update" commands explicitly, we clear # out sources.list so that 'apt-get update' doesn't do anything. +RUN echo >/etc/apt/sources.list + +ENV GO_VERSION 1.4.2 +RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz +ENV PATH /usr/local/go/bin:$PATH + +# So that sudo does not trample on PATH +RUN sed -ie '/secure_path/d' /etc/sudoers -RUN sh -c 'apt-get -y update && apt-get -y install --no-install-recommends build-essential git ca-certificates golang docker.io mercurial libpcap-dev curl make pkg-config gcc bison flex && echo >/etc/apt/sources.list' COPY build.sh / ENTRYPOINT ["sh", "/build.sh"] diff --git a/build/build.sh b/build/build.sh index 3863d97d..7c6d13a4 100644 --- a/build/build.sh +++ b/build/build.sh @@ -35,7 +35,7 @@ EOF echo "weave:x:$uid:$gid::$WEAVE_SRC:/bin/sh" >>/etc/passwd echo "weave:*:::::::" >>/etc/shadow echo "weave ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers - su weave -c "make -C $WEAVE_SRC build" + su weave -c "PATH=$PATH make -C $WEAVE_SRC build" else # There are arguments to pass to git-clone mkdir -p ${WEAVE_SRC%/*} diff --git a/site/building.md b/site/building.md index e5985109..4c636f61 100644 --- a/site/building.md +++ b/site/building.md @@ -31,15 +31,20 @@ $ git clone https://$WEAVE $GOPATH/src/$WEAVE $ cd $GOPATH/src/$WEAVE ``` -Some prerequisites are needed to build weave. First, install Docker -if you haven't already, by following the instructions [on the Docker -site](https://docs.docker.com/installation/ubuntulinux/). Note that -we recommend using the Docker-maintained `lxc-docker` package, rather -than the `docker.io` package which contains a very old version. Then -install the other prerequisites for building with: +Some prerequisites are needed to build weave: +* Install Docker if you haven't already, by following the instructions + [on the Docker + site](https://docs.docker.com/installation/ubuntulinux/). Note that + we recommend using the Docker-maintained `lxc-docker` package, rather + than the `docker.io` package which contains a very old version. Then + install the other prerequisites for building with: +* Building weave requires Go 1.4.2, and the `golang` package in Ubuntu + 14.04 LTS is too old. So you may need to [install the tarball from + golang.org](http://golang.org/doc/install). +* A few other packages are also needed: ```bash -$ sudo apt-get install build-essential git golang mercurial libpcap-dev +$ sudo apt-get install build-essential git mercurial libpcap-dev ``` Then to actually build, simply do: