From b6658596f32844015325c440412e6d02e4bf1fa1 Mon Sep 17 00:00:00 2001 From: Zhenghui Wang Date: Mon, 29 Jul 2019 18:02:49 -0700 Subject: [PATCH] split the dockerfile (#104) --- Dockerfile | 23 +++++++++++------------ dockerfiles/Dockerfile-linux-base | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 dockerfiles/Dockerfile-linux-base diff --git a/Dockerfile b/Dockerfile index 94473ee69..cf0eb3b53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,16 @@ -# Build docker image at gcr.io/images-public/metadata: +# This file builds the metadata backend server image at +# gcr.io/kubeflow-images-public/metadata. +# +# The docker build flags are +# BASE_IMG: base image that has Go and Bazel installed. +# OUTPUT_DIR: the platform name that Bazel used to ouput the executable. -FROM golang:1.12 +ARG BASE_IMG=gcr.io/kubeflow-images-public/metadata-base +FROM ${BASE_IMG} -ENV GO111MODULE on - -RUN apt-get update && apt-get -y install cmake unzip patch wget && apt-get clean +ARG OUTPUT_DIR=linux_amd64_stripped -RUN cd /tmp && \ - wget -O /tmp/bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh && \ - chmod +x bazel-installer.sh && \ - ./bazel-installer.sh --user - -ENV PATH=/root/bin:${PATH} +ENV GO111MODULE on WORKDIR /go/src/github.com/kubeflow/metadata @@ -19,7 +18,7 @@ COPY . . RUN bazel build -c opt --define=grpc_no_ares=true //... -RUN cp bazel-bin/server/linux_amd64_stripped/server server/server +RUN cp bazel-bin/server/${OUTPUT_DIR}/server server/server # Copy Licenses RUN wget https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt -O GRPC-GATEWAY-LICENSE.txt diff --git a/dockerfiles/Dockerfile-linux-base b/dockerfiles/Dockerfile-linux-base new file mode 100644 index 000000000..247e45901 --- /dev/null +++ b/dockerfiles/Dockerfile-linux-base @@ -0,0 +1,15 @@ +# This file builds the base image for metadata backend server. +# The images are at gcr.io/kubeflow-images-public/metadata-base. + +FROM golang:1.12 + +RUN apt-get update && apt-get -y install cmake unzip patch wget && apt-get clean + +RUN cd /tmp && \ + wget -O /tmp/bazel-installer.sh https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel-0.24.1-installer-linux-x86_64.sh && \ + chmod +x bazel-installer.sh && \ + ./bazel-installer.sh --user + +ENV PATH=/root/bin:${PATH} + +CMD ["bash"]