diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 5192cba5bd..0000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,38 +0,0 @@ -pipeline { - parameters { - booleanParam(name: 'IS_DISABLED_APIFE_BUILD', defaultValue: false, description: '') - booleanParam(name: 'IS_DISABLED_ENGINE_BUILD', defaultValue: false, description: '') - booleanParam(name: 'IS_IMAGE_BEING_PUBLISHED', defaultValue: false, description: '') - } - agent { - docker { - image 'seldonio/core-builder:0.8' - args '-v /root/.m2:/root/.m2' - } - } - environment { - SELDON_CORE_DOCKER_HUB_USER = credentials('SELDON_CORE_DOCKER_HUB_USER') - SELDON_CORE_DOCKER_HUB_PASSWORD = credentials('SELDON_CORE_DOCKER_HUB_PASSWORD') - } - stages { - stage('build-engine') { - when { - expression { return params.IS_DISABLED_ENGINE_BUILD == false } - } - steps { - echo "Build Image" - sh 'cd engine && make -f Makefile.ci build' - script { - if (params.IS_IMAGE_BEING_PUBLISHED == true) { - echo "Publish Image" - sh 'cd engine && make -f Makefile.ci repo_login' - sh 'cd engine && make -f Makefile.ci push_image' - } else { - echo "Publish Image [SKIPPED]" - } - } - } - } - } -} - diff --git a/Makefile.ci b/Makefile.ci index cab422ba29..498f283bdf 100644 --- a/Makefile.ci +++ b/Makefile.ci @@ -1,15 +1,15 @@ .PHONY: build build: @set -x && cd seldon-controller && make -f Makefile $@ - @set -x && cd engine && make -f Makefile.ci clean $@ + @set -x && cd engine && make -f Makefile clean $@ .PHONY: push_images_private_repo push_images_private_repo: @set -x && cd seldon-controller && make -f Makefile push_image_private_repo - @set -x && cd engine && make -f Makefile.ci push_image_private_repo + @set -x && cd engine && make -f Makefile push_image_private_repo .PHONY: clean clean: - cd engine && make -f Makefile.ci clean $@ + cd engine && make -f Makefile clean $@ cd seldon-controller && make -f Makefile clean $@ diff --git a/build-all-in-minikube b/build-all-in-minikube deleted file mode 100755 index 6f073c67f6..0000000000 --- a/build-all-in-minikube +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -set -o nounset -set -o errexit -set -o pipefail - -STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )" - -function do_build { - local SELDON_CORE_VM_DIR=$1 - eval $(minikube docker-env) - docker run --rm -it \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v /home/docker/.m2:/root/.m2 \ - -v ${SELDON_CORE_VM_DIR}:/work \ - seldonio/core-builder:0.3 bash -c 'make -f Makefile.ci build' -} - -SELDON_CORE_LOCAL_DIR=${STARTUP_DIR} - -UNAME_S=$(uname -s) - -SELDON_CORE_VM_DIR=UNKOWN -if [ ${UNAME_S} = "Darwin" ]; then - SELDON_CORE_VM_DIR=${SELDON_CORE_LOCAL_DIR} -fi -if [ ${UNAME_S} = "Linux" ]; then - SELDON_CORE_VM_DIR=$(echo ${SELDON_CORE_LOCAL_DIR}|sed -e 's|^/home/|/hosthome/|') -fi - -echo "-------------------------------------------------" -echo "Translating paths" -echo "local: ${SELDON_CORE_LOCAL_DIR}" -echo " vm: ${SELDON_CORE_VM_DIR}" -echo "-------------------------------------------------" -do_build ${SELDON_CORE_VM_DIR} - diff --git a/build-all-private-repo b/build-all-private-repo deleted file mode 100755 index 3f122df314..0000000000 --- a/build-all-private-repo +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -set -o nounset -set -o errexit -set -o pipefail - -STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )" - -cd "$STARTUP_DIR" - -docker run --rm -it \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v $HOME/.m2:/root/.m2 \ - -v $PWD:/work \ - seldonio/core-builder:0.3 bash -c 'make -f Makefile.ci build' - diff --git a/engine/Dockerfile b/engine/Dockerfile index df948c5e64..88ce0d29fe 100644 --- a/engine/Dockerfile +++ b/engine/Dockerfile @@ -1,14 +1,22 @@ -FROM openjdk:11.0.5-jre-slim +FROM maven:3.6.3-jdk-11 as builder + +WORKDIR /workspace + +COPY pom.xml pom.xml +COPY src/ src/ -ARG APP_VERSION=UNKOWN_VERSION +# Build +RUN mvn clean verify -Dlicense.useMissingFile -B + +FROM openjdk:11.0.5-jre-slim RUN \ apt-get update -y && \ apt-get remove -y --auto-remove && \ apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -COPY /target/seldon-engine-${APP_VERSION}.jar app.jar -COPY /target/generated-resources /licenses/ +COPY --from=builder /workspace/target/seldon-engine-*.jar app.jar +COPY --from=builder /workspace/target/generated-resources /licenses/ ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar app.jar" ] diff --git a/engine/Dockerfile.mvn b/engine/Dockerfile.mvn deleted file mode 100644 index fcecb74085..0000000000 --- a/engine/Dockerfile.mvn +++ /dev/null @@ -1,22 +0,0 @@ -FROM maven:3.6.1-jdk-8 as builder - -WORKDIR /workspace - -COPY pom.xml pom.xml -COPY src/ src/ - -# Build -RUN mvn clean verify -Dlicense.useMissingFile -B - -FROM openjdk:11.0.5-jre-slim - -RUN \ - apt-get update -y && \ - apt-get remove -y --auto-remove && \ - apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -COPY --from=builder /workspace/target/seldon-engine-*.jar app.jar -COPY --from=builder /workspace/target/generated-resources /licenses/ - -ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom $JAVA_OPTS -jar app.jar" ] - diff --git a/engine/Makefile b/engine/Makefile index 44b0fff463..a560bbf01a 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -8,7 +8,7 @@ build_jar: update_proto update_swagger mvn clean verify -Dlicense.useMissingFile -B build_image: update_proto update_swagger - docker build -f Dockerfile.mvn -t seldonio/$(IMAGE_NAME):$(VERSION) . + docker build -f Dockerfile -t seldonio/$(IMAGE_NAME):$(VERSION) . push_to_registry: docker push seldonio/$(IMAGE_NAME):$(VERSION) @@ -31,10 +31,15 @@ start_engine: engine.json stop_engine: engine.json kubectl delete --ignore-not-found=true -f engine.json +download_protos_k8s: + cd ../proto/k8s ; make create_protos -update_proto: - @cp -v ../proto/seldon_deployment.proto src/main/proto/ - @cp -v ../proto/prediction.proto src/main/proto/ +download_protos_tensorflow: + cd ../proto/tensorflow ; make create_protos + +update_proto: download_protos_k8s download_protos_tensorflow + cp -v ../proto/seldon_deployment.proto src/main/proto/ + cp -v ../proto/prediction.proto src/main/proto/ cp -vr ../proto/k8s/k8s.io src/main/proto cp -vr ../proto/tensorflow/tensorflow src/main/proto diff --git a/engine/Makefile.ci b/engine/Makefile.ci deleted file mode 100644 index 3773bdae52..0000000000 --- a/engine/Makefile.ci +++ /dev/null @@ -1,51 +0,0 @@ -IMAGE_NAME=seldonio/engine -VERSION_FILE=target/version.txt - -LOCAL_PRIVATE_REPO=127.0.0.1:5000 - -# clean and build image -build: clean build_image - - -build_jar: update_proto update_swagger - @set -x && mvn clean verify -Dlicense.useMissingFile -B - -write_version: build_jar - ls target/seldon-engine-*.jar | sed -n 's/target\/seldon-engine-\(.*\).jar$$/\1/p' > $(VERSION_FILE) && cat $(VERSION_FILE) - -build_image: write_version - docker build --build-arg APP_VERSION=$$(cat $(VERSION_FILE)) -t $(IMAGE_NAME):latest . - docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):$$(cat $(VERSION_FILE)) - docker tag $(IMAGE_NAME):latest $(LOCAL_PRIVATE_REPO)/$(IMAGE_NAME):$$(cat $(VERSION_FILE)) - -repo_login: - if [ ! -z "${SELDON_CORE_DOCKER_HUB_USER}" ] && [ ! -z "${SELDON_CORE_DOCKER_HUB_PASSWORD}" ]; then \ - docker login -u ${SELDON_CORE_DOCKER_HUB_USER} -p ${SELDON_CORE_DOCKER_HUB_PASSWORD}; \ - else \ - echo "Missing credentials!"; \ - fi - -push_image: - docker push $(IMAGE_NAME):$$(cat $(VERSION_FILE)) - -push_image_private_repo: - @set -x && docker push $(LOCAL_PRIVATE_REPO)/$(IMAGE_NAME):$$(cat $(VERSION_FILE)) - -clean: - mvn clean -B - rm -fr src/main/proto/* - -download_protos_k8s: - cd ../proto/k8s ; make create_protos - -download_protos_tensorflow: - cd ../proto/tensorflow ; make create_protos - -update_proto: download_protos_k8s download_protos_tensorflow - cp -v ../proto/seldon_deployment.proto src/main/proto/ - cp -v ../proto/prediction.proto src/main/proto/ - cp -vr ../proto/k8s/k8s.io src/main/proto - cp -vr ../proto/tensorflow/tensorflow src/main/proto - -update_swagger: - cp -v ../openapi/engine.oas3.json src/main/resources/static/seldon.json diff --git a/jenkins-x.yml b/jenkins-x.yml index 2ffb57773f..3207df5fc0 100644 --- a/jenkins-x.yml +++ b/jenkins-x.yml @@ -37,7 +37,7 @@ pipelineConfig: command: make args: - -C engine - - -f Makefile.ci + - -f Makefile - build_jar - name: seldon-operator steps: diff --git a/push-all-private-repo b/push-all-private-repo deleted file mode 100755 index 003e5c26e0..0000000000 --- a/push-all-private-repo +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -o nounset -set -o errexit -set -o pipefail -set -o xtrace - -STARTUP_DIR="$( cd "$( dirname "$0" )" && pwd )" - -cd "$STARTUP_DIR" - -docker run --rm -it \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v $HOME/.m2:/root/.m2 \ - -v $PWD:/work \ - seldonio/core-builder:0.3 bash -c 'make -f Makefile.ci push_images_private_repo' -