contrib: Dockerfile: add a base stage

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-04-05 12:26:55 +02:00
parent a07e12cded
commit a84f87d84f
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -8,8 +8,12 @@
ARG GOLANG_VERSION=1.11 ARG GOLANG_VERSION=1.11
FROM golang:${GOLANG_VERSION} AS golang-base
RUN mkdir -p /go/src/github.com/containerd/containerd
WORKDIR /go/src/github.com/containerd/containerd
# Install proto3 # Install proto3
FROM golang:${GOLANG_VERSION} AS proto3 FROM golang-base AS proto3
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
autoconf \ autoconf \
automake \ automake \
@ -22,17 +26,17 @@ COPY script/setup/install-protobuf install-protobuf
RUN ./install-protobuf RUN ./install-protobuf
# Install runc # Install runc
FROM golang:${GOLANG_VERSION} AS runc FROM golang-base AS runc
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
curl \ curl \
libseccomp-dev \ libseccomp-dev \
--no-install-recommends --no-install-recommends
COPY vendor.conf /go/src/github.com/containerd/containerd/vendor.conf COPY vendor.conf vendor.conf
COPY script/setup/install-runc install-runc COPY script/setup/install-runc install-runc
RUN ./install-runc RUN ./install-runc
FROM golang:${GOLANG_VERSION} AS dev FROM golang-base AS dev
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
btrfs-tools \ btrfs-tools \
gcc \ gcc \
@ -46,6 +50,4 @@ COPY --from=proto3 /usr/local/bin/protoc /usr/local/bin/protoc
COPY --from=proto3 /usr/local/include/google /usr/local/include/google COPY --from=proto3 /usr/local/include/google /usr/local/include/google
COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc COPY --from=runc /usr/local/sbin/runc /usr/local/go/bin/runc
COPY . /go/src/github.com/containerd/containerd COPY . .
WORKDIR /go/src/github.com/containerd/containerd