Browse code

Dockerfile.e2e: move frozen-images to a separate stage

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/04/19 23:15:03
Showing 1 changed files
... ...
@@ -1,5 +1,4 @@
1
-## Step 1: Build tests
2
-FROM golang:1.12.4-alpine as builder
1
+FROM golang:1.12.4-alpine as base
3 2
 
4 3
 RUN apk --no-cache add \
5 4
     bash \
... ...
@@ -9,17 +8,22 @@ RUN apk --no-cache add \
9 9
     lvm2-dev \
10 10
     jq
11 11
 
12
+RUN mkdir -p /build/
12 13
 RUN mkdir -p /go/src/github.com/docker/docker/
13 14
 WORKDIR /go/src/github.com/docker/docker/
14 15
 
15
-# Generate frozen images
16
-COPY contrib/download-frozen-image-v2.sh contrib/download-frozen-image-v2.sh
17
-RUN contrib/download-frozen-image-v2.sh /output/docker-frozen-images \
16
+FROM base AS frozen-images
17
+# Get useful and necessary Hub images so we can "docker load" locally instead of pulling
18
+COPY contrib/download-frozen-image-v2.sh /
19
+RUN /download-frozen-image-v2.sh /build \
18 20
 	buildpack-deps:jessie@sha256:dd86dced7c9cd2a724e779730f0a53f93b7ef42228d4344b25ce9a42a1486251 \
19 21
 	busybox:latest@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0 \
20 22
 	busybox:glibc@sha256:0b55a30394294ab23b9afd58fab94e61a923f5834fba7ddbae7f8e0c11ba85e6 \
21 23
 	debian:jessie@sha256:287a20c5f73087ab406e6b364833e3fb7b3ae63ca0eb3486555dc27ed32c6e60 \
22 24
 	hello-world:latest@sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c
25
+# See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
26
+
27
+FROM base AS builder
23 28
 
24 29
 # Install dockercli
25 30
 # Please edit hack/dockerfile/install/<name>.installer to update them.
... ...
@@ -38,7 +42,7 @@ RUN CGO_ENABLED=0 go build -buildmode=pie -o /output/httpserver github.com/docke
38 38
 RUN hack/make.sh build-integration-test-binary
39 39
 RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /output/tests \;
40 40
 
41
-## Step 2: Generate testing image
41
+## Generate testing image
42 42
 FROM alpine:3.9 as runner
43 43
 
44 44
 # GNU tar is used for generating the emptyfs image
... ...
@@ -64,7 +68,7 @@ COPY integration-cli/fixtures   /tests/integration-cli/fixtures
64 64
 COPY hack/test/e2e-run.sh /scripts/run.sh
65 65
 COPY hack/make/.ensure-emptyfs /scripts/ensure-emptyfs.sh
66 66
 
67
-COPY --from=builder /output/docker-frozen-images /docker-frozen-images
67
+COPY --from=frozen-images /build/ /docker-frozen-images
68 68
 COPY --from=builder /output/httpserver /tests/contrib/httpserver/httpserver
69 69
 COPY --from=builder /output/tests /tests
70 70
 COPY --from=builder /usr/local/bin/docker /usr/bin/docker