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

assaf-java-s2i-update #2178

Merged
merged 9 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 8 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
3 changes: 2 additions & 1 deletion incubating/wrappers/s2i/java/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM seldonio/core-builder:0.3
ARG IMAGE_SOURCE=seldonio/core-builder:0.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try bumping the core-builder image to 0.16 (which is the latest)?

FROM $IMAGE_SOURCE

LABEL io.openshift.s2i.scripts-url="image:///s2i/bin"

Expand Down
3 changes: 2 additions & 1 deletion incubating/wrappers/s2i/java/Dockerfile.runtime
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM openjdk:8u131-jre-alpine
ARG IMAGE_SOURCE=openjdk:8u131-jre-alpine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly as above, could you also bump the runtime base to openjdk:13.0.1-jdk-buster (which is what the latest core-builder uses)?

FROM $IMAGE_SOURCE

RUN apk update && apk add bash

Expand Down
100 changes: 100 additions & 0 deletions incubating/wrappers/s2i/java/bin/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/usr/bin/env bash

#
# Description:
# This is a helper script to produce an S2I Build and S2I Runtime images
# to build and run the Java Wrapper. This helper script provides the flexibility
# to specify the source images to be used for the S2I Build and S2I Runtime images.
#
# This allows you to build a custom images based on different source / base images which
# could be used for testing or pushed to Docker Hub.
#
# Example:
# bash bin/build.sh \
# --build-source-image seldonio/core-builder:0.15 \
# --runtime-source-image adoptopenjdk/openjdk13:alpine-slim \
# jw-0.2.0-jre-13
#
# will produce two images:
# 1. docker.io/seldonio/seldon-core-s2i-java-build:jw-0.2.0-jre-13
# 1. docker.io/seldonio/seldon-core-s2i-java-runtime:jw-0.2.0-jre-13
#
# Authors:
# Assaf Moldavsky ([email protected])
#

set -x

#
# Print the usage and exit.
#
function usage () {
echo "Usage: $0 [OPTIONS] VERSION"
echo "\r\n"
echo "Options: "
echo " --build-source-image (OPTIONAL) override the build image source image"
echo " --build-runtime-image (OPTIONAL) override the runtime image source image"
exit 1
}

# Parse the arguments.
# loop until last - 1, we assume the last arg is the model name
while [[ $# -ge 2 ]]
do
key="$1"
case ${key} in
--build-source-image)
BUILD_SOURCE_IMAGE="$2"
shift # past key
shift # past value
;;
--runtime-source-image)
RUNTIME_SOURCE_IMAGE="$2"
shift # past key
shift # past value
;;
*)
usage
;;
esac
done

# assign last parameter to model
VERSION=${@:${#@}}
IMAGE_BUILD_BUILD_ARGS=""
IMAGE_RUNTIME_BUILD_ARGS=""

# Validate the arguments.
if [[ -z "$VERSION" ]]; then
echo "Missing argument: VERSION."
usage
fi

# Prepare Docker build args ( if supplied )
if ! [[ -z "$BUILD_SOURCE_IMAGE" ]]; then
IMAGE_BUILD_BUILD_ARGS=$(echo "$IMAGE_BUILD_BUILD_ARGS --build-arg IMAGE_SOURCE=$BUILD_SOURCE_IMAGE" | awk '{$1=$1};1')
fi
if ! [[ -z "$RUNTIME_SOURCE_IMAGE" ]]; then
IMAGE_RUNTIME_BUILD_ARGS=$(echo "$IMAGE_RUNTIME_BUILD_ARGS --build-arg IMAGE_SOURCE=$RUNTIME_SOURCE_IMAGE" | awk '{$1=$1};1')
fi

IMAGE_NAME_BUILD=docker.io/seldonio/seldon-core-s2i-java-build:${VERSION}
IMAGE_NAME_RUNTIME=docker.io/seldonio/seldon-core-s2i-java-runtime:${VERSION}

echo "S2I build image: building..."
docker build \
-f Dockerfile.build \
-t ${IMAGE_NAME_BUILD} \
${IMAGE_BUILD_BUILD_ARGS} \
.
echo "S2I build image: check Java version..."
docker run --entrypoint "/bin/bash" ${IMAGE_NAME_BUILD} "-c" "java --version"

echo "S2I runtime image: building..."
docker build \
-f Dockerfile.runtime \
-t ${IMAGE_NAME_RUNTIME} \
${IMAGE_RUNTIME_BUILD_ARGS} \
.
echo "S2I runtime image: check Java version..."
docker run --entrypoint "/bin/bash" ${IMAGE_NAME_RUNTIME} "-c" "java --version"