Skip to content

Commit

Permalink
Backend - Simplified sample compilationThere is not need to install J…
Browse files Browse the repository at this point in the history
…ava, run swagger codegen, build and install the package. The pipelines can be compiled without all that.
  • Loading branch information
Ark-kun committed Dec 1, 2018
1 parent 9d38f71 commit ba2bfef
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,10 @@ COPY . .
RUN apk add --update gcc musl-dev
RUN go build -o /bin/apiserver backend/src/apiserver/*.go

FROM python:3.5 as compiler
FROM python:3.5 as sample-compiler
RUN pip3 install PyYAML

RUN apt-get update -y && \
apt-get install --no-install-recommends -y -q default-jdk wget

RUN pip3 install setuptools==40.5.0

RUN wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar -O /tmp/swagger-codegen-cli.jar

WORKDIR /go/src/github.com/kubeflow/pipelines
COPY . .
WORKDIR /go/src/github.com/kubeflow/pipelines/sdk/python
RUN ./build.sh /kfp.tar.gz
RUN pip3 install /kfp.tar.gz

WORKDIR /samples
COPY ./samples .
COPY . /pipelines

#We need to check that all samples have been compiled without error.
#For find program, the -exec argument is a filter predicate just like -name. It only affects whether the file is "found", not the find's exit code.
Expand All @@ -39,8 +26,7 @@ COPY ./samples .
#I think it's better to just use a shell loop though.
#RUN for pipeline in $(find . -maxdepth 2 -name '*.py' -type f); do dsl-compile --py "$pipeline" --output "$pipeline.tar.gz"; done
#The "for" loop breaks on all whitespace, so we either need to override IFS or use the "read" command instead.
RUN find . -maxdepth 2 -name '*.py' -type f | while read pipeline; do dsl-compile --py "$pipeline" --output "$pipeline.tar.gz"; done

RUN find /pipelines/samples -maxdepth 2 -name '*.py' -type f | while read pipeline; do PYTHONPATH=/pipelines/sdk/python "$pipeline"; done

FROM alpine

Expand All @@ -53,7 +39,7 @@ COPY --from=builder /bin/apiserver /bin/apiserver
COPY --from=builder /go/src/github.com/kubeflow/pipelines/third_party/license.txt /bin/license.txt
COPY backend/src/apiserver/config/ /config

COPY --from=compiler /samples/ /samples/
COPY --from=sample-compiler /pipelines/samples /samples

# Adding CA certificate so API server can download pipeline through URL
RUN apk add ca-certificates
Expand Down

0 comments on commit ba2bfef

Please sign in to comment.