Skip to content

Commit

Permalink
Merge pull request influxdata#347 from jonseymour/jss-enable-cache
Browse files Browse the repository at this point in the history
Allow /root/go/src to be cached during docker build
  • Loading branch information
Nathaniel Cook committed Mar 17, 2016
2 parents 3b05b8a + d2a540d commit f414b82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile_build_ubuntu64
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ RUN mkdir -p $PROJECT_DIR
WORKDIR $PROJECT_DIR

VOLUME $PROJECT_DIR
VOLUME /root/go/src

# Configure local git
RUN git config --global user.email "[email protected]"
Expand Down
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ set -e
DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
cd $DIR


# Build new docker image
docker build -f Dockerfile_build_ubuntu64 -t influxdata/kapacitor-builder $DIR
if test "${KAPACITOR_USE_BUILD_CACHE}" = "true"; then
# create a container that owns the /root/go/src volume used as a cache of go dependency downloads
# ignore failures, since this usually means the container already exists.
docker run --entrypoint=/bin/true --name kapacitor-builder-cache influxdata/kapacitor-builder 2>/dev/null &&
VOLUME_OPTIONS=--volumes-from kapacitor-builder-cache || true
else
VOLUME_OPTIONS=
fi

echo "Running build.py"
# Run docker
docker run --rm \
-e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" \
-e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" \
${VOLUME_OPTIONS} \
-v $DIR:/root/go/src/github.com/influxdata/kapacitor \
influxdata/kapacitor-builder \
"$@"

0 comments on commit f414b82

Please sign in to comment.