These scripts are only used to build the binaries, and
the scripts themselves don't have to be persisted in an
image, so we can mount them instead of copying to the stage
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
... | ... |
@@ -145,82 +145,73 @@ FROM runtime-dev-cross-${CROSS} AS runtime-dev |
145 | 145 |
|
146 | 146 |
FROM base AS tomlv |
147 | 147 |
ARG TOMLV_COMMIT |
148 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
149 |
-COPY hack/dockerfile/install/tomlv.installer ./ |
|
150 | 148 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
151 | 149 |
--mount=type=cache,target=/go/pkg/mod \ |
152 |
- PREFIX=/build ./install.sh tomlv |
|
150 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
151 |
+ PREFIX=/build /tmp/install/install.sh tomlv |
|
153 | 152 |
|
154 | 153 |
FROM base AS vndr |
155 | 154 |
ARG VNDR_COMMIT |
156 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
157 |
-COPY hack/dockerfile/install/vndr.installer ./ |
|
158 | 155 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
159 | 156 |
--mount=type=cache,target=/go/pkg/mod \ |
160 |
- PREFIX=/build ./install.sh vndr |
|
157 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
158 |
+ PREFIX=/build /tmp/install/install.sh vndr |
|
161 | 159 |
|
162 | 160 |
FROM dev-base AS containerd |
163 | 161 |
ARG DEBIAN_FRONTEND |
164 |
-ARG CONTAINERD_COMMIT |
|
165 | 162 |
RUN --mount=type=cache,sharing=locked,id=moby-containerd-aptlib,target=/var/lib/apt \ |
166 | 163 |
--mount=type=cache,sharing=locked,id=moby-containerd-aptcache,target=/var/cache/apt \ |
167 | 164 |
apt-get update && apt-get install -y --no-install-recommends \ |
168 | 165 |
libbtrfs-dev |
169 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
170 |
-COPY hack/dockerfile/install/containerd.installer ./ |
|
166 |
+ARG CONTAINERD_COMMIT |
|
171 | 167 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
172 | 168 |
--mount=type=cache,target=/go/pkg/mod \ |
173 |
- PREFIX=/build ./install.sh containerd |
|
169 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
170 |
+ PREFIX=/build /tmp/install/install.sh containerd |
|
174 | 171 |
|
175 | 172 |
FROM dev-base AS proxy |
176 | 173 |
ARG LIBNETWORK_COMMIT |
177 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
178 |
-COPY hack/dockerfile/install/proxy.installer ./ |
|
179 | 174 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
180 | 175 |
--mount=type=cache,target=/go/pkg/mod \ |
181 |
- PREFIX=/build ./install.sh proxy |
|
176 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
177 |
+ PREFIX=/build /tmp/install/install.sh proxy |
|
182 | 178 |
|
183 | 179 |
FROM base AS golangci_lint |
184 | 180 |
ARG GOLANGCI_LINT_COMMIT |
185 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
186 |
-COPY hack/dockerfile/install/golangci_lint.installer ./ |
|
187 | 181 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
188 | 182 |
--mount=type=cache,target=/go/pkg/mod \ |
189 |
- PREFIX=/build ./install.sh golangci_lint |
|
183 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
184 |
+ PREFIX=/build /tmp/install/install.sh golangci_lint |
|
190 | 185 |
|
191 | 186 |
FROM base AS gotestsum |
192 | 187 |
ARG GOTESTSUM_COMMIT |
193 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
194 |
-COPY hack/dockerfile/install/gotestsum.installer ./ |
|
195 | 188 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
196 | 189 |
--mount=type=cache,target=/go/pkg/mod \ |
197 |
- PREFIX=/build ./install.sh gotestsum |
|
190 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
191 |
+ PREFIX=/build /tmp/install/install.sh gotestsum |
|
198 | 192 |
|
199 | 193 |
FROM base AS shfmt |
200 | 194 |
ARG SHFMT_COMMIT |
201 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
202 |
-COPY hack/dockerfile/install/shfmt.installer ./ |
|
203 | 195 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
204 | 196 |
--mount=type=cache,target=/go/pkg/mod \ |
205 |
- PREFIX=/build ./install.sh shfmt |
|
197 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
198 |
+ PREFIX=/build /tmp/install/install.sh shfmt |
|
206 | 199 |
|
207 | 200 |
FROM dev-base AS dockercli |
208 | 201 |
ARG DOCKERCLI_CHANNEL |
209 | 202 |
ARG DOCKERCLI_VERSION |
210 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
211 |
-COPY hack/dockerfile/install/dockercli.installer ./ |
|
212 | 203 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
213 | 204 |
--mount=type=cache,target=/go/pkg/mod \ |
214 |
- PREFIX=/build ./install.sh dockercli |
|
205 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
206 |
+ PREFIX=/build /tmp/install/install.sh dockercli |
|
215 | 207 |
|
216 | 208 |
FROM runtime-dev AS runc |
217 | 209 |
ARG RUNC_COMMIT |
218 | 210 |
ARG RUNC_BUILDTAGS |
219 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
220 |
-COPY hack/dockerfile/install/runc.installer ./ |
|
221 | 211 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
222 | 212 |
--mount=type=cache,target=/go/pkg/mod \ |
223 |
- PREFIX=/build ./install.sh runc |
|
213 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
214 |
+ PREFIX=/build /tmp/install/install.sh runc |
|
224 | 215 |
|
225 | 216 |
FROM dev-base AS tini |
226 | 217 |
ARG DEBIAN_FRONTEND |
... | ... |
@@ -230,19 +221,17 @@ RUN --mount=type=cache,sharing=locked,id=moby-tini-aptlib,target=/var/lib/apt \ |
230 | 230 |
apt-get update && apt-get install -y --no-install-recommends \ |
231 | 231 |
cmake \ |
232 | 232 |
vim-common |
233 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
234 |
-COPY hack/dockerfile/install/tini.installer ./ |
|
235 | 233 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
236 | 234 |
--mount=type=cache,target=/go/pkg/mod \ |
237 |
- PREFIX=/build ./install.sh tini |
|
235 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
236 |
+ PREFIX=/build /tmp/install/install.sh tini |
|
238 | 237 |
|
239 | 238 |
FROM dev-base AS rootlesskit |
240 | 239 |
ARG ROOTLESSKIT_COMMIT |
241 |
-COPY hack/dockerfile/install/install.sh ./install.sh |
|
242 |
-COPY hack/dockerfile/install/rootlesskit.installer ./ |
|
243 | 240 |
RUN --mount=type=cache,target=/root/.cache/go-build \ |
244 | 241 |
--mount=type=cache,target=/go/pkg/mod \ |
245 |
- PREFIX=/build/ ./install.sh rootlesskit |
|
242 |
+ --mount=type=bind,src=hack/dockerfile/install,target=/tmp/install \ |
|
243 |
+ PREFIX=/build /tmp/install/install.sh rootlesskit |
|
246 | 244 |
COPY ./contrib/dockerd-rootless.sh /build |
247 | 245 |
|
248 | 246 |
FROM djs55/vpnkit:${VPNKIT_VERSION} AS vpnkit |