diff --git a/build/Dockerfile b/build/Dockerfile index 74904563..46b584bc 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,6 +1,12 @@ FROM ubuntu -# After installing the prerequisite we clear out sources.list so that -# 'apt-get update' doesn't do anything. + +# 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 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/tools/build.sh b/tools/build.sh index 2bfd2e0f..87528a09 100644 --- a/tools/build.sh +++ b/tools/build.sh @@ -1,4 +1,6 @@ #!/bin/sh + +# Show the progress of this script, in case it fails. set -x -e sudo apt-get -y update