Skip to content

Commit

Permalink
use local copy of _operator instead of symlink (like in master)
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalSkolasinski authored and seldondev committed Feb 4, 2021
1 parent d7d6e37 commit 2fae2b5
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 28 deletions.
1 change: 1 addition & 0 deletions executor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ cover.out
executor.tar
openapi/
executor/api/rest/openapi/
_operator
22 changes: 11 additions & 11 deletions executor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY executor/go.mod go.mod
COPY executor/go.sum go.sum
COPY executor/proto/ proto/
COPY go.mod go.mod
COPY go.sum go.sum
COPY 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/
COPY _operator/ _operator/
RUN go mod download

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

# Build
RUN go build -a -o executor main.go
Expand All @@ -27,15 +27,15 @@ RUN wget -O armon-consul-api.tar.gz https://github.com/armon/consul-api/archive/
RUN wget -O hasicorp-hcl.tar.gz https://github.com/hashicorp/hcl/archive/master.tar.gz

# Copy OpenAPI folder and change the permissions
COPY executor/api/rest/openapi/ /openapi/
COPY 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 executor/licenses/license.txt licenses/license.txt
COPY licenses/license.txt licenses/license.txt
COPY --from=builder /workspace/hashicorp-golang-lru.tar.gz licenses/mpl_source/hashicorp-golang-lru.tar.gz
COPY --from=builder /workspace/armon-consul-api.tar.gz licenses/mpl_source/armon-consul-api.tar.gz
COPY --from=builder /workspace/hasicorp-hcl.tar.gz licenses/mpl_source/hasicorp-hcl.tar.gz
Expand Down
22 changes: 11 additions & 11 deletions executor/Dockerfile.redhat
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY executor/go.mod go.mod
COPY executor/go.sum go.sum
COPY executor/proto/ proto/
COPY go.mod go.mod
COPY go.sum go.sum
COPY 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/
COPY _operator/ _operator/
RUN go mod download

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

# Build
RUN go build -a -o executor main.go
Expand All @@ -27,7 +27,7 @@ RUN wget -O armon-consul-api.tar.gz https://github.com/armon/consul-api/archive/
RUN wget -O hasicorp-hcl.tar.gz https://github.com/hashicorp/hcl/archive/master.tar.gz

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

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

WORKDIR /
COPY --from=builder /workspace/executor .
COPY executor/licenses/license.txt licenses/license.txt
COPY licenses/license.txt licenses/license.txt
COPY --from=builder /workspace/hashicorp-golang-lru.tar.gz licenses/mpl_source/hashicorp-golang-lru.tar.gz
COPY --from=builder /workspace/armon-consul-api.tar.gz licenses/mpl_source/armon-consul-api.tar.gz
COPY --from=builder /workspace/hasicorp-hcl.tar.gz licenses/mpl_source/hasicorp-hcl.tar.gz
Expand Down
16 changes: 11 additions & 5 deletions executor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ vet:


# Build manager binary
executor: fmt vet
executor: copy_operator fmt vet
go build -o executor main.go


.PHONY: copy_operator
copy_operator:
rm -rf _operator
cp -r ../operator _operator


.PHONY: copy_protos
copy_protos:
cp -r ../proto/tensorflow/tensorflow/** proto/tensorflow
Expand Down Expand Up @@ -59,7 +65,7 @@ add_protos:
cd serving && find ./tensorflow_serving -name '*.proto' | cpio -pdm ../proto

# Run tests
test: fmt vet
test: copy_operator fmt vet
go test ${EXECUTOR_FOLDERS} -coverprofile cover.out

copy_openapi_resources:
Expand All @@ -69,11 +75,11 @@ copy_openapi_resources:

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

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

# Push the docker image
docker-push:
Expand Down Expand Up @@ -127,7 +133,7 @@ licenses: licenses/dep.txt
concatenate-license -o licenses/license.txt licenses/license_info.csv


lint: licenses/dep.txt
lint: copy_operator licenses/dep.txt
# Check if licenses have changed
git \
--no-pager diff \
Expand Down
2 changes: 1 addition & 1 deletion executor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ require (

replace github.com/tensorflow/tensorflow/tensorflow/go/core => ./proto/tensorflow/core

replace github.com/seldonio/seldon-core/operator => ./operator
replace github.com/seldonio/seldon-core/operator => ./_operator
2 changes: 2 additions & 0 deletions executor/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
Expand Down Expand Up @@ -344,6 +345,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR
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=
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
Expand Down

0 comments on commit 2fae2b5

Please sign in to comment.