Skip to content
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
2 changes: 1 addition & 1 deletion k8/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spec:
spec:
containers:
- name: polaris
image: localhost:5001/polaris:latest
image: localhost:5001/apache/polaris:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

just wondering: why do we need localhost:5001? Is it not assumed by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that's the registry part of the image name, and defaults to docker.io if unspecified: apache/polaris expands to docker.io/apache/polaris.

This post explains it well.

ports:
- containerPort: 8181
- containerPort: 8182
Expand Down
44 changes: 17 additions & 27 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,56 +21,46 @@

# Runs Polaris as a mini-deployment locally. Creates two pods that bind themselves to port 8181.

# Initialize variables
BUILD_ARGS="" # Initialize an empty string to store Docker build arguments

# Function to display usage information
usage() {
echo "Usage: $0 [-b build-arg1=value1;build-arg2=value2;...] [-h]"
echo " -b Pass a set of arbitrary build arguments to docker build, separated by semicolons"
echo " -h Display this help message"
echo "Usage: $0 [--eclipse-link-deps=<deps>] [-h|--help]"
echo " --eclipse-link-deps=<deps> EclipseLink dependencies to use, e.g."
echo " --eclipse-link-deps=org.postgresql:postgresql:42.7.4"
echo " -h, --help Display this help message"
exit 1
}

# Parse command-line arguments
while getopts "b:h" opt; do
case ${opt} in
b)
IFS=';' read -ra ARGS <<< "${OPTARG}" # Split the semicolon-separated list into an array
for arg in "${ARGS[@]}"; do
BUILD_ARGS+=" --build-arg ${arg}" # Append each build argument to the list
done
while [[ "$#" -gt 0 ]]; do
case $1 in
--eclipse-link-deps=*)
ECLIPSE_LINK_DEPS="-PeclipseLinkDeps=${1#*=}"
;;
h)
-h|--help)
usage
;;
*)
usage
;;
esac
shift
done

# Shift off the options and arguments
shift $((OPTIND-1))

# Deploy the registry
echo "Building Kind Registry..."
sh ./kind-registry.sh

# Check if BUILD_ARGS is not empty and print the build arguments
if [[ -n "$BUILD_ARGS" ]]; then
echo "Building polaris image with build arguments:$BUILD_ARGS"
else
echo "Building polaris image without any additional build arguments."
fi

# Build and deploy the server image
echo "Building polaris image..."
docker build -t localhost:5001/polaris $BUILD_ARGS -f Dockerfile .
./gradlew :polaris-quarkus-server:build $ECLIPSE_LINK_DEPS \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.registry=localhost:5001

echo "Pushing polaris image..."
docker push localhost:5001/polaris
docker push localhost:5001/apache/polaris

echo "Loading polaris image to kind..."
kind load docker-image localhost:5001/polaris:latest
kind load docker-image localhost:5001/apache/polaris:latest

echo "Applying kubernetes manifests..."
kubectl delete -f k8/deployment.yaml --ignore-not-found
Expand Down
Loading