Skip to content

Commit

Permalink
use local copy of operator in executor build
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSkolasinski committed Jul 14, 2020
1 parent 6b08ee4 commit ee14258
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 26 deletions.
1 change: 0 additions & 1 deletion executor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ cover.out
executor.tar
openapi/
executor/api/rest/openapi/

21 changes: 11 additions & 10 deletions executor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,34 @@ FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY proto/ proto/
COPY executor/go.mod go.mod
COPY executor/go.sum go.sum
COPY executor/proto/ proto/
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
COPY executor/operator/ operator/
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY predictor/ predictor/
COPY logger/ logger/
COPY k8s/ k8s/
COPY executor/main.go main.go
COPY executor/api/ api/
COPY executor/predictor/ predictor/
COPY executor/logger/ logger/
COPY executor/k8s/ k8s/

# Build
RUN go build -a -o executor main.go

# Copy OpenAPI folder and change the permissions
COPY api/rest/openapi/ /openapi/
COPY executor/api/rest/openapi/ /openapi/
RUN chmod -R 660 /openapi/

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/base:latest
WORKDIR /
COPY --from=builder /workspace/executor .
COPY licenses/license.txt licenses/license.txt
COPY executor/licenses/license.txt licenses/license.txt
# Copy openapi spec and swagger UI files
COPY --from=builder /openapi/ /openapi/

Expand Down
21 changes: 11 additions & 10 deletions executor/Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY proto/ proto/
COPY executor/go.mod go.mod
COPY executor/go.sum go.sum
COPY executor/proto/ proto/
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
COPY executor/operator/ operator/
RUN go mod download

# Copy the go source
COPY main.go main.go
COPY api/ api/
COPY predictor/ predictor/
COPY logger/ logger/
COPY k8s/ k8s/
COPY executor/main.go main.go
COPY executor/api/ api/
COPY executor/predictor/ predictor/
COPY executor/logger/ logger/
COPY executor/k8s/ k8s/

# Build
RUN go build -a -o executor main.go

# Copy OpenAPI folder and change the permissions
COPY api/rest/openapi/ /openapi/
COPY executor/api/rest/openapi/ /openapi/
RUN chmod -R 660 /openapi/

FROM registry.access.redhat.com/ubi8/ubi-minimal
Expand All @@ -34,7 +35,7 @@ LABEL name="Seldon Executor" \

WORKDIR /
COPY --from=builder /workspace/executor .
COPY licenses/license.txt licenses/license.txt
COPY executor/licenses/license.txt licenses/license.txt

# Copy openapi spec and swagger UI files
COPY --from=builder /openapi/ /openapi/
Expand Down
4 changes: 2 additions & 2 deletions executor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ copy_openapi_resources:

# Build the docker image
docker-build: test copy_openapi_resources
docker build -f Dockerfile -t ${IMG} .
cd .. && docker build -f executor/Dockerfile -t ${IMG} .

# Build the docker image for Redhat
docker-build-redhat: test copy_openapi_resources
docker build . -f Dockerfile.redhat -t ${IMG_REDHAT}
cd .. && docker build -f executor/Dockerfile.redhat -t ${IMG_REDHAT} .

# Push the docker image
docker-push:
Expand Down
3 changes: 2 additions & 1 deletion executor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.10.0
github.com/seldonio/seldon-core/operator v0.0.0-20200713165058-0562e155e38f
github.com/seldonio/seldon-core/operator v0.0.0-00010101000000-000000000000
github.com/soheilhy/cmux v0.1.4
github.com/tensorflow/tensorflow/tensorflow/go/core v0.0.0-00010101000000-000000000000
github.com/uber/jaeger-client-go v2.24.0+incompatible
Expand All @@ -30,3 +30,4 @@ require (
)

replace github.com/tensorflow/tensorflow/tensorflow/go/core => ./proto/tensorflow/core
replace github.com/seldonio/seldon-core/operator => ./operator
2 changes: 0 additions & 2 deletions executor/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,6 @@ github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqn
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/seldonio/seldon-core/operator v0.0.0-20200713165058-0562e155e38f h1:z9GsZL3d7oO9cjbMi3vhWpWHr0X+4aG4ERY5y6uWNa4=
github.com/seldonio/seldon-core/operator v0.0.0-20200713165058-0562e155e38f/go.mod h1:9e34AkYnKA/EZD5aXC9eu81f1LXmP55Mdotv7hYfJLY=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
Expand Down
1 change: 1 addition & 0 deletions executor/operator

0 comments on commit ee14258

Please sign in to comment.