Skip to content

Commit f9f423c

Browse files
committed
Dockerfile.test: standard directory to collect build aftifacts
This allows for easier copying artifacts from stages, by just copying the directory content to the stage where it's used. These stages are not used to be run individually so do not have to be "runnable". Each stage is "responsible" for colllecting all aftifacts in the directory, so that "consumer" stages do not have to be aware of what needs to be copied. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent e9f26eb commit f9f423c

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

contrib/Dockerfile.test

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ COPY script/setup/runc-version script/setup/install-runc ./
2424
# Allow overriding the version of runc to install through build-args
2525
ARG RUNC_VERSION
2626
ARG GOPROXY=direct
27+
ARG DESTDIR=/build
2728
RUN ./install-runc
2829

2930
FROM golang AS build-env
@@ -46,7 +47,7 @@ FROM build-env AS cri-in-userns
4647
RUN apt-get update && apt-get install -y iptables
4748
COPY contrib/Dockerfile.test.d/cri-in-userns/etc_containerd_config.toml /etc/containerd/config.toml
4849
COPY contrib/Dockerfile.test.d/cri-in-userns/docker-entrypoint.sh /docker-entrypoint.sh
49-
COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc
50+
COPY --from=runc /build/ /
5051
COPY . .
5152
RUN ./script/setup/install-cni
5253
RUN ./script/setup/install-critools
@@ -60,19 +61,20 @@ CMD ["critest", "--ginkgo.skip=should support unsafe sysctls|should support safe
6061

6162
# Install proto3
6263
FROM golang AS proto3
63-
RUN apt-get update && apt-get install -y \
64-
autoconf \
65-
automake \
66-
g++ \
67-
libtool \
68-
unzip \
69-
--no-install-recommends
64+
ARG DESTDIR=/build
65+
RUN apt-get update && apt-get install -y --no-install-recommends \
66+
autoconf \
67+
automake \
68+
g++ \
69+
libtool \
70+
unzip
7071

7172
COPY script/setup/install-protobuf install-protobuf
72-
RUN ./install-protobuf
73+
RUN ./install-protobuf \
74+
&& mv /usr/local/bin/protoc $DESTDIR/usr/local/bin/protoc \
75+
&& mv /usr/local/include/google $DESTDIR/usr/local/include/google
7376

7477
FROM build-env AS dev
75-
COPY --from=proto3 /usr/local/bin/protoc /usr/local/bin/protoc
76-
COPY --from=proto3 /usr/local/include/google /usr/local/include/google
77-
COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc
78+
COPY --from=proto3 /build/ /
79+
COPY --from=runc /build/ /
7880
COPY . .

0 commit comments

Comments
 (0)