Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use copy of operator instead of symlink to keep docker build context local #2335

Merged
merged 2 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions executor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ cover.out
executor.tar
openapi/
executor/api/rest/openapi/
_operator
22 changes: 11 additions & 11 deletions executor/Dockerfile.executor
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/cmd/ cmd/
COPY executor/api/ api/
COPY executor/predictor/ predictor/
COPY executor/logger/ logger/
COPY executor/k8s/ k8s/
COPY cmd/ cmd/
COPY api/ api/
COPY predictor/ predictor/
COPY logger/ logger/
COPY k8s/ k8s/

# Build
RUN go build -a -o executor cmd/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.executor.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/cmd/ cmd/
COPY executor/api/ api/
COPY executor/predictor/ predictor/
COPY executor/logger/ logger/
COPY executor/k8s/ k8s/
COPY cmd/ cmd/
COPY api/ api/
COPY predictor/ predictor/
COPY logger/ logger/
COPY k8s/ k8s/

# Build
RUN go build -a -o executor cmd/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/ubi7/ubi
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
19 changes: 13 additions & 6 deletions executor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ vet:


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

kafka-proxy: fmt vet

kafka-proxy: copy_operator fmt vet
go build -o kafka-proxy cmd/proxy/main.go


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


.PHONY: copy_protos
copy_protos:
cp -r ../proto/tensorflow/tensorflow/** proto/tensorflow
Expand Down Expand Up @@ -62,7 +69,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 @@ -72,11 +79,11 @@ copy_openapi_resources:

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

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

# Push the docker image
docker-push:
Expand Down Expand Up @@ -133,7 +140,7 @@ licenses: licenses/dep.txt


.PHONY: lint
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 @@ -30,4 +30,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
1 change: 0 additions & 1 deletion executor/operator

This file was deleted.