Browse code

Merge pull request #36425 from vdemeester/dockerfile-adjusts

Follow-up fixes on multi-stage moby's Dockerfile

Sebastiaan van Stijn authored on 2018/03/01 07:07:27
Showing 1 changed files
... ...
@@ -32,23 +32,14 @@
32 32
 # the case. Therefore, you don't have to disable it anymore.
33 33
 #
34 34
 
35
-FROM buildpack-deps:stretch AS base
35
+FROM golang:1.9.4 AS base
36
+# FIXME(vdemeester) this is kept for other script depending on it to not fail right away
37
+# Remove this once the other scripts uses something else to detect the version
38
+ENV GO_VERSION 1.9.4
36 39
 # allow replacing httpredir or deb mirror
37 40
 ARG APT_MIRROR=deb.debian.org
38 41
 RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
39 42
 
40
-
41
-FROM base AS golang
42
-# IMPORTANT: If the version of Go is updated, the Windows to Linux CI machines
43
-#            will need updating, to avoid errors. Ping #docker-maintainers on IRC
44
-#            with a heads-up.
45
-# IMPORTANT: When updating this please note that stdlib archive/tar pkg is vendored
46
-ENV GO_VERSION 1.9.4
47
-RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" \
48
-	| tar -xzC /usr/local
49
-ENV PATH=/usr/local/go/bin:/go/bin:$PATH GOPATH=/go
50
-
51
-
52 43
 FROM base AS criu
53 44
 # Install CRIU for checkpoint/restore support
54 45
 ENV CRIU_VERSION 3.6
... ...
@@ -69,7 +60,7 @@ RUN apt-get update && apt-get install -y \
69 69
 	&& make PREFIX=/opt/criu install-criu
70 70
 
71 71
 
72
-FROM golang AS registry
72
+FROM base AS registry
73 73
 # Install two versions of the registry. The first is an older version that
74 74
 # only supports schema1 manifests. The second is a newer version that supports
75 75
 # both. This allows integration-cli tests to cover push/pull with both schema1
... ...
@@ -89,7 +80,7 @@ RUN set -x \
89 89
 
90 90
 
91 91
 
92
-FROM golang AS notary
92
+FROM base AS notary
93 93
 # Install notary and notary-server
94 94
 ENV NOTARY_VERSION v0.5.0
95 95
 RUN set -x \
... ...
@@ -113,7 +104,7 @@ RUN git clone https://github.com/docker/docker-py.git /docker-py \
113 113
 
114 114
 
115 115
 
116
-FROM golang AS swagger
116
+FROM base AS swagger
117 117
 # Install go-swagger for validating swagger.yaml
118 118
 ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb
119 119
 RUN set -x \
... ...
@@ -124,7 +115,7 @@ RUN set -x \
124 124
 	&& rm -rf "$GOPATH"
125 125
 
126 126
 
127
-FROM golang AS frozen-images
127
+FROM base AS frozen-images
128 128
 RUN apt-get update && apt-get install -y jq ca-certificates --no-install-recommends
129 129
 # Get useful and necessary Hub images so we can "docker load" locally instead of pulling
130 130
 COPY contrib/download-frozen-image-v2.sh /
... ...
@@ -137,44 +128,44 @@ RUN /download-frozen-image-v2.sh /docker-frozen-images \
137 137
 # See also ensureFrozenImagesLinux() in "integration-cli/fixtures_linux_daemon_test.go" (which needs to be updated when adding images to this list)
138 138
 
139 139
 # Just a little hack so we don't have to install these deps twice, once for runc and once for dockerd
140
-FROM golang AS runtime-dev
140
+FROM base AS runtime-dev
141 141
 RUN apt-get update && apt-get install -y \
142 142
 	libapparmor-dev \
143 143
 	libseccomp-dev
144 144
 
145 145
 
146
-FROM golang AS tomlv
146
+FROM base AS tomlv
147 147
 ENV INSTALL_BINARY_NAME=tomlv
148 148
 COPY hack/dockerfile/install/install.sh ./install.sh
149 149
 COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
150 150
 RUN PREFIX=/opt/$INSTALL_BINARY_NAME ./install.sh $INSTALL_BINARY_NAME
151 151
 
152
-FROM golang AS vndr
152
+FROM base AS vndr
153 153
 ENV INSTALL_BINARY_NAME=vndr
154 154
 COPY hack/dockerfile/install/install.sh ./install.sh
155 155
 COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
156 156
 RUN PREFIX=/opt/$INSTALL_BINARY_NAME ./install.sh $INSTALL_BINARY_NAME
157 157
 
158
-FROM golang AS containerd
158
+FROM base AS containerd
159 159
 RUN apt-get update && apt-get install -y btrfs-tools
160 160
 ENV INSTALL_BINARY_NAME=containerd
161 161
 COPY hack/dockerfile/install/install.sh ./install.sh
162 162
 COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
163 163
 RUN PREFIX=/opt/$INSTALL_BINARY_NAME ./install.sh $INSTALL_BINARY_NAME
164 164
 
165
-FROM golang AS proxy
165
+FROM base AS proxy
166 166
 ENV INSTALL_BINARY_NAME=proxy
167 167
 COPY hack/dockerfile/install/install.sh ./install.sh
168 168
 COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
169 169
 RUN PREFIX=/opt/$INSTALL_BINARY_NAME ./install.sh $INSTALL_BINARY_NAME
170 170
 
171
-FROM golang AS gometalinter
171
+FROM base AS gometalinter
172 172
 ENV INSTALL_BINARY_NAME=gometalinter
173 173
 COPY hack/dockerfile/install/install.sh ./install.sh
174 174
 COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
175 175
 RUN PREFIX=/opt/$INSTALL_BINARY_NAME ./install.sh $INSTALL_BINARY_NAME
176 176
 
177
-FROM golang AS dockercli
177
+FROM base AS dockercli
178 178
 ENV INSTALL_BINARY_NAME=dockercli
179 179
 COPY hack/dockerfile/install/install.sh ./install.sh
180 180
 COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
... ...
@@ -232,6 +223,8 @@ RUN apt-get update && apt-get install -y \
232 232
 	vim-common \
233 233
 	xfsprogs \
234 234
 	zip \
235
+	bzip2 \
236
+	xz-utils \
235 237
 	--no-install-recommends
236 238
 COPY --from=swagger /usr/local/bin/swagger* /usr/local/bin/
237 239
 COPY --from=frozen-images /docker-frozen-images /docker-frozen-images
... ...
@@ -243,7 +236,6 @@ COPY --from=runc /opt/runc/ /usr/local/bin/
243 243
 COPY --from=containerd /opt/containerd/ /usr/local/bin/
244 244
 COPY --from=proxy /opt/proxy/ /usr/local/bin/
245 245
 COPY --from=dockercli /opt/dockercli /usr/local/cli
246
-COPY --from=golang /usr/local/go /usr/local/go
247 246
 COPY --from=registry /usr/local/bin/registry* /usr/local/bin/
248 247
 COPY --from=notary /usr/local/bin/notary* /usr/local/bin/
249 248
 COPY --from=criu /opt/criu/ /usr/local/