Merge pull request #40059 from cpuguy83/move_source_copy
Fix trick for `make BINDDIR=. shell` and `COPY .`
This commit is contained in:
commit
d56adcf0ec
10
Dockerfile
10
Dockerfile
|
@ -297,19 +297,21 @@ WORKDIR /go/src/github.com/docker/docker
|
||||||
VOLUME /var/lib/docker
|
VOLUME /var/lib/docker
|
||||||
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
||||||
ENTRYPOINT ["hack/dind"]
|
ENTRYPOINT ["hack/dind"]
|
||||||
|
|
||||||
|
FROM dev AS src
|
||||||
COPY . /go/src/github.com/docker/docker
|
COPY . /go/src/github.com/docker/docker
|
||||||
|
|
||||||
FROM dev AS build-binary
|
FROM src AS build-binary
|
||||||
ARG DOCKER_GITCOMMIT=HEAD
|
ARG DOCKER_GITCOMMIT=HEAD
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
hack/make.sh binary
|
hack/make.sh binary
|
||||||
|
|
||||||
FROM dev AS build-dynbinary
|
FROM src AS build-dynbinary
|
||||||
ARG DOCKER_GITCOMMIT=HEAD
|
ARG DOCKER_GITCOMMIT=HEAD
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
hack/make.sh dynbinary
|
hack/make.sh dynbinary
|
||||||
|
|
||||||
FROM dev AS build-cross
|
FROM src AS build-cross
|
||||||
ARG DOCKER_GITCOMMIT=HEAD
|
ARG DOCKER_GITCOMMIT=HEAD
|
||||||
ARG DOCKER_CROSSPLATFORMS=""
|
ARG DOCKER_CROSSPLATFORMS=""
|
||||||
RUN --mount=type=cache,target=/root/.cache/go-build \
|
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
|
FROM scratch AS cross
|
||||||
COPY --from=build-cross /go/src/github.com/docker/docker/bundles/ /
|
COPY --from=build-cross /go/src/github.com/docker/docker/bundles/ /
|
||||||
|
|
||||||
FROM dev AS final
|
FROM src AS final
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -192,7 +192,11 @@ install: ## install the linux binaries
|
||||||
run: build ## run the docker daemon in a container
|
run: build ## run the docker daemon in a container
|
||||||
$(DOCKER_RUN_DOCKER) sh -c "KEEPBUNDLE=1 hack/make.sh install-binary run"
|
$(DOCKER_RUN_DOCKER) sh -c "KEEPBUNDLE=1 hack/make.sh install-binary run"
|
||||||
|
|
||||||
|
ifeq ($(BIND_DIR), .)
|
||||||
shell: DOCKER_BUILD_ARGS += --target=dev
|
shell: DOCKER_BUILD_ARGS += --target=dev
|
||||||
|
else
|
||||||
|
shell: DOCKER_BUILD_ARGS += --target=final
|
||||||
|
endif
|
||||||
shell: BUILDX_BUILD_EXTRA_OPTS += --load
|
shell: BUILDX_BUILD_EXTRA_OPTS += --load
|
||||||
shell: build ## start a shell inside the build env
|
shell: build ## start a shell inside the build env
|
||||||
$(DOCKER_RUN_DOCKER) bash
|
$(DOCKER_RUN_DOCKER) bash
|
||||||
|
|
Loading…
Reference in New Issue