Skip to content

Commit

Permalink
Adapt Kind run.sh script to Quarkus (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra authored Jan 23, 2025
1 parent 3be2084 commit 27710e3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
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
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

0 comments on commit 27710e3

Please sign in to comment.