Merge pull request #40059 from cpuguy83/move_source_copy

Fix trick for `make BINDDIR=. shell` and `COPY .`
This commit is contained in:
Tibor Vass 2019-10-10 13:38:23 -07:00 committed by GitHub
commit d56adcf0ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View File

@ -297,19 +297,21 @@ WORKDIR /go/src/github.com/docker/docker
VOLUME /var/lib/docker
# Wrap all commands in the "docker-in-docker" script to allow nested containers
ENTRYPOINT ["hack/dind"]
FROM dev AS src
COPY . /go/src/github.com/docker/docker
FROM dev AS build-binary
FROM src AS build-binary
ARG DOCKER_GITCOMMIT=HEAD
RUN --mount=type=cache,target=/root/.cache/go-build \
hack/make.sh binary
FROM dev AS build-dynbinary
FROM src AS build-dynbinary
ARG DOCKER_GITCOMMIT=HEAD
RUN --mount=type=cache,target=/root/.cache/go-build \
hack/make.sh dynbinary
FROM dev AS build-cross
FROM src AS build-cross
ARG DOCKER_GITCOMMIT=HEAD
ARG DOCKER_CROSSPLATFORMS=""
RUN --mount=type=cache,target=/root/.cache/go-build \
@ -324,4 +326,4 @@ COPY --from=build-dynbinary /go/src/github.com/docker/docker/bundles/ /
FROM scratch AS cross
COPY --from=build-cross /go/src/github.com/docker/docker/bundles/ /
FROM dev AS final
FROM src AS final

View File

@ -192,7 +192,11 @@ install: ## install the linux binaries
run: build ## run the docker daemon in a container
$(DOCKER_RUN_DOCKER) sh -c "KEEPBUNDLE=1 hack/make.sh install-binary run"
ifeq ($(BIND_DIR), .)
shell: DOCKER_BUILD_ARGS += --target=dev
else
shell: DOCKER_BUILD_ARGS += --target=final
endif
shell: BUILDX_BUILD_EXTRA_OPTS += --load
shell: build ## start a shell inside the build env
$(DOCKER_RUN_DOCKER) bash