Fix trick for `make BINDDIR=. shell` and `COPY .`
| ... | ... |
@@ -297,19 +297,21 @@ WORKDIR /go/src/github.com/docker/docker |
| 297 | 297 |
VOLUME /var/lib/docker |
| 298 | 298 |
# Wrap all commands in the "docker-in-docker" script to allow nested containers |
| 299 | 299 |
ENTRYPOINT ["hack/dind"] |
| 300 |
+ |
|
| 301 |
+FROM dev AS src |
|
| 300 | 302 |
COPY . /go/src/github.com/docker/docker |
| 301 | 303 |
|
| 302 |
-FROM dev AS build-binary |
|
| 304 |
+FROM src AS build-binary |
|
| 303 | 305 |
ARG DOCKER_GITCOMMIT=HEAD |
| 304 | 306 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
| 305 | 307 |
hack/make.sh binary |
| 306 | 308 |
|
| 307 |
-FROM dev AS build-dynbinary |
|
| 309 |
+FROM src AS build-dynbinary |
|
| 308 | 310 |
ARG DOCKER_GITCOMMIT=HEAD |
| 309 | 311 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
| 310 | 312 |
hack/make.sh dynbinary |
| 311 | 313 |
|
| 312 |
-FROM dev AS build-cross |
|
| 314 |
+FROM src AS build-cross |
|
| 313 | 315 |
ARG DOCKER_GITCOMMIT=HEAD |
| 314 | 316 |
ARG DOCKER_CROSSPLATFORMS="" |
| 315 | 317 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
| ... | ... |
@@ -324,4 +326,4 @@ COPY --from=build-dynbinary /go/src/github.com/docker/docker/bundles/ / |
| 324 | 324 |
FROM scratch AS cross |
| 325 | 325 |
COPY --from=build-cross /go/src/github.com/docker/docker/bundles/ / |
| 326 | 326 |
|
| 327 |
-FROM dev AS final |
|
| 327 |
+FROM src AS final |
| ... | ... |
@@ -192,7 +192,11 @@ install: ## install the linux binaries |
| 192 | 192 |
run: build ## run the docker daemon in a container |
| 193 | 193 |
$(DOCKER_RUN_DOCKER) sh -c "KEEPBUNDLE=1 hack/make.sh install-binary run" |
| 194 | 194 |
|
| 195 |
+ifeq ($(BIND_DIR), .) |
|
| 195 | 196 |
shell: DOCKER_BUILD_ARGS += --target=dev |
| 197 |
+else |
|
| 198 |
+shell: DOCKER_BUILD_ARGS += --target=final |
|
| 199 |
+endif |
|
| 196 | 200 |
shell: BUILDX_BUILD_EXTRA_OPTS += --load |
| 197 | 201 |
shell: build ## start a shell inside the build env |
| 198 | 202 |
$(DOCKER_RUN_DOCKER) bash |