aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build-docker-otp
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-03-08 10:44:02 +0100
committerBjörn Gustavsson <[email protected]>2017-03-08 14:29:51 +0100
commit247412294cbd04ecbd9680646b16d08f53255caa (patch)
tree38e6f7f86542f8da599b1f3d236c1f0a8550a1a9 /scripts/build-docker-otp
parentc1dab09a681edac9684afea4b6e2522475cea2f0 (diff)
downloadotp-247412294cbd04ecbd9680646b16d08f53255caa.tar.gz
otp-247412294cbd04ecbd9680646b16d08f53255caa.tar.bz2
otp-247412294cbd04ecbd9680646b16d08f53255caa.zip
build-docker-otp: Avoid copying the git repository to docker daemon
Since docker is run from the top-level of the otp repository, the entire repository will be the context for the docker daemon. In my private repository, more than 800Mb had to be copied before the build could be started. Let the ./scripts directory be the context for docker instead. That way, only the otp.tar.gz file needs to be copied. While we are it, also use the ADD command in the Dockerfiles to pack up the tar file and avoid copying the tar file itself to the Docker image.
Diffstat (limited to 'scripts/build-docker-otp')
-rwxr-xr-xscripts/build-docker-otp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/build-docker-otp b/scripts/build-docker-otp
index 928b84a32d..01bb0b628e 100755
--- a/scripts/build-docker-otp
+++ b/scripts/build-docker-otp
@@ -8,7 +8,8 @@ fi
ARCH="$1"
shift
-git archive --format=tar.gz --prefix=otp/ HEAD >otp.tar.gz
+git archive --format=tar.gz --prefix=otp/ HEAD >scripts/otp.tar.gz
-docker build -t otp --file scripts/Dockerfile.$ARCH .
+docker build -t otp --file scripts/Dockerfile.$ARCH scripts
+rm scripts/otp.tar.gz
docker run --volume="$PWD/logs:/buildroot/otp/logs" -i --rm otp ${1+"$@"}