Speedup build by skipping what's bind-mounted#29298
Speedup build by skipping what's bind-mounted#29298thaJeztah wants to merge 1 commit intomoby:masterfrom
Conversation
Makefile
Outdated
There was a problem hiding this comment.
should not it be moved to after L47?
There was a problem hiding this comment.
Let me think; I think the issue was that that the original BIND_DIR is overwritten at line 47, and will be either $BINDDIR or "bundles". If it's "bundles", the source-code is not bind-mounted. So we need to look at what's provided at the command-line; if BINDDIR=. or BIND_DIR=. is provided, then the intent was to bind-mount the source files.
I'll check once more
|
Seems $ make binary
...
Step 51/51 : ENTRYPOINT hack/dind
---> Using cache
---> fe0b68bd073c
Successfully built fe0b68bd073c
mv .dockerignore.orig .dockerignore
rm "Dockerfile.tmp"
docker run --rm -i --privileged -e BUILD_APT_MIRROR -e BUILDFLAGS -e KEEPBUNDLE -e DOCKER_BUILD_ARGS -e DOCKER_BUILD_GOGC -e DOCKER_BUILD_PKGS -e DOCKER_DEBUG -e DOCKER_EXPERIMENTAL -e DOCKER_GITCOMMIT -e DOCKER_GRAPHDRIVER -e DOCKER_INCREMENTAL_BINARY -e DOCKER_PORT -e DOCKER_REMAP_ROOT -e DOCKER_STORAGE_OPTS -e DOCKER_USERLANDPROXY -e TESTDIRS -e TESTFLAGS -e TIMEOUT -e HTTP_PROXY -e HTTPS_PROXY -e NO_PROXY -e http_proxy -e https_proxy -e no_proxy -v "/home/suda/gopath/src/github.com/docker/docker/bundles:/go/src/github.com/docker/docker/bundles" -v "dockerdev-go-pkg-cache-gopath:/go/pkg" -v "dockerdev-go-pkg-cache-goroot-linux_amd64_netgo:/usr/local/go/pkg/linux_amd64_netgo" -t "docker-dev:thaJeztah-faster-build" hack/make.sh binary
docker: Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "exec: \"hack/dind\": stat hack/dind: no such file or directory".
Makefile:86: recipe for target 'binary' failed
make: *** [binary] Error 127 |
Interesting. Let me try and find where that is coming from |
When `BIND_DIR` is used, all source-code is bind-mounted into the container, so there's no need to `COPY` the source in the image. This patch skips the files that are bind-mounted, preventing it from being sent as build-context, and added to the image through `COPY`. Some hacks were needed for the `.dockerignore` file, because we currently don't support specifying an alternative `.dockerignore` file. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
704ae3b to
dbe484f
Compare
|
My SSD thanks you. |
| docker build ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE).tmp" . | ||
|
|
||
| mv .dockerignore.orig .dockerignore | ||
| rm "$(DOCKERFILE).tmp" |
There was a problem hiding this comment.
It seems we also need to add *.tmp to .gitignore.
|
@thaJeztah: Could you find a way to do this without the .dockerignore? It'd be easy to create a temporary build directory for the subset of files and build from there. This would let us avoid the .dockerignore tricks. |
|
I don't know. |
|
@cpuguy83 we could check on that. But "bundles" is the default? https://github.com/docker/docker/pull/29298/files#r92125529 (https://github.com/docker/docker/pull/29298/files#diff-b67911656ef5d18c4ae36cb6741b7965L46) |
|
It is when no DOCKER_HOST is set. |
|
@thaJeztah @cpuguy83 any progress on this? |
|
ping @thaJeztah |
When
BIND_DIRis used, all source-code is bind-mounted into the container, so there's no need toCOPYthe source in the image.This patch skips the files that are bind-mounted, preventing it from being sent as build-context, and added to the image through
COPY.Some hacks were needed for the
.dockerignorefile, because we currently don't support specifying an alternative.dockerignorefile.