From dc6d1ac66373241e7d1376a0cdd0c22999e6d7fb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 19 Apr 2019 16:15:03 +0200 Subject: [PATCH] Dockerfile.e2e: move frozen-images to a separate stage Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 5554bd1a7b1841f06ef1a5630dda2e19d1d72c72) Signed-off-by: Sebastiaan van Stijn --- Dockerfile.e2e | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Dockerfile.e2e b/Dockerfile.e2e index 74e69e53d9..c1ce4922cd 100644 --- a/Dockerfile.e2e +++ b/Dockerfile.e2e @@ -1,5 +1,4 @@ -## Step 1: Build tests -FROM golang:1.12.4-alpine as builder +FROM golang:1.12.4-alpine as base RUN apk --no-cache add \ bash \ @@ -9,17 +8,22 @@ RUN apk --no-cache add \ lvm2-dev \ jq +RUN mkdir -p /build/ RUN mkdir -p /go/src/github.com/docker/docker/ WORKDIR /go/src/github.com/docker/docker/ -# Generate frozen images -COPY contrib/download-frozen-image-v2.sh contrib/download-frozen-image-v2.sh -RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \ +FROM base AS frozen-images +# Get useful and necessary Hub images so we can "docker load" locally instead of pulling +COPY contrib/download-frozen-image-v2.sh / +RUN /download-frozen-image-v2.sh /build \ buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \ busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \ busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \ debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \ hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c +# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list) + +FROM base AS builder # Install dockercli # Please edit hack/dockerfile/install/.installer to update them. @@ -38,7 +42,7 @@ RUN CGO_ENABLED=0 go build -buildmode=pie -o /output/httpserver github.com/docke RUN hack/make.sh build-integration-test-binary RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /output/tests \; -## Step 2: Generate testing image +## Generate testing image FROM alpine:3.9 as runner # GNU tar is used for generating the emptyfs image @@ -64,7 +68,7 @@ COPY integration-cli/fixtures /tests/integration-cli/fixtures COPY hack/test/e2e-run.sh /scripts/run.sh COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh -COPY --from=builder /output/docker-frozen-images /docker-frozen-images +COPY --from=frozen-images /build/ /docker-frozen-images COPY --from=builder /output/httpserver /tests/contrib/httpserver/httpserver COPY --from=builder /output/tests /tests COPY --from=builder /usr/local/bin/docker /usr/bin/docker