Skip to content

Commit a84f87d

Browse files
committed
contrib: Dockerfile: add a base stage
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent a07e12c commit a84f87d

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

contrib/Dockerfile.test

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99
ARG GOLANG_VERSION=1.11
1010

11+
FROM golang:${GOLANG_VERSION} AS golang-base
12+
RUN mkdir -p /go/src/github.com/containerd/containerd
13+
WORKDIR /go/src/github.com/containerd/containerd
14+
1115
# Install proto3
12-
FROM golang:${GOLANG_VERSION} AS proto3
16+
FROM golang-base AS proto3
1317
RUN apt-get update && apt-get install -y \
1418
autoconf \
1519
automake \
@@ -22,17 +26,17 @@ COPY script/setup/install-protobuf install-protobuf
2226
RUN ./install-protobuf
2327

2428
# Install runc
25-
FROM golang:${GOLANG_VERSION} AS runc
29+
FROM golang-base AS runc
2630
RUN apt-get update && apt-get install -y \
2731
curl \
2832
libseccomp-dev \
2933
--no-install-recommends
3034

31-
COPY vendor.conf /go/src/github.com/containerd/containerd/vendor.conf
35+
COPY vendor.conf vendor.conf
3236
COPY script/setup/install-runc install-runc
3337
RUN ./install-runc
3438

35-
FROM golang:${GOLANG_VERSION} AS dev
39+
FROM golang-base AS dev
3640
RUN apt-get update && apt-get install -y \
3741
btrfs-tools \
3842
gcc \
@@ -46,6 +50,4 @@ COPY --from=proto3 /usr/local/bin/protoc /usr/local/bin/protoc
4650
COPY --from=proto3 /usr/local/include/google /usr/local/include/google
4751
COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc
4852

49-
COPY . /go/src/github.com/containerd/containerd
50-
51-
WORKDIR /go/src/github.com/containerd/containerd
53+
COPY . .

0 commit comments

Comments
 (0)