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
91 changes: 73 additions & 18 deletions bin/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,62 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


set -e

# Prompt for base tag
# Default values
DEFAULT_TAG="latest"
read -p "Enter the base tag for the images [${DEFAULT_TAG}]: " BASE_TAG
BASE_TAG=${BASE_TAG:-$DEFAULT_TAG}

# Prompt for which services to build
DEFAULT_SERVICES="*"
read -p "Enter services to build (comma-separated, '*' for all) [${DEFAULT_SERVICES}]: " SERVICES_INPUT
SERVICES_INPUT=${SERVICES_INPUT:-$DEFAULT_SERVICES}
WITH_R_SUPPORT="false"

# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--tag|-t)
BASE_TAG="$2"
shift 2
;;
--services|-s)
SERVICES_INPUT="$2"
shift 2
;;
--with-r-support)
WITH_R_SUPPORT="true"
shift
;;
--help|-h)
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " -t, --tag TAG Base tag for the images (default: latest)"
echo " -s, --services SERVICES Services to build, comma-separated or '*' for all (default: *)"
echo " --with-r-support Enable R support for computing-unit-master (sets WITH_R_SUPPORT=true)"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 --tag v1.0.0 --services '*' --with-r-support"
echo " $0 -t latest -s 'gui,computing-unit-master'"
echo " $0 # Interactive mode"
exit 0
;;
*)
echo "❌ Unknown option: $1"
echo "Run '$0 --help' for usage information."
exit 1
;;
esac
done

# If BASE_TAG not provided via command-line, prompt interactively
if [[ -z "$BASE_TAG" ]]; then
read -p "Enter the base tag for the images [${DEFAULT_TAG}]: " BASE_TAG
BASE_TAG=${BASE_TAG:-$DEFAULT_TAG}
fi

# If SERVICES_INPUT not provided via command-line, prompt interactively
if [[ -z "$SERVICES_INPUT" ]]; then
read -p "Enter services to build (comma-separated, '*' for all) [${DEFAULT_SERVICES}]: " SERVICES_INPUT
SERVICES_INPUT=${SERVICES_INPUT:-$DEFAULT_SERVICES}
fi

# Convert the user input into an array for easy lookup
IFS=',' read -ra SELECTED_SERVICES <<< "$SERVICES_INPUT"
Expand Down Expand Up @@ -64,6 +107,9 @@ fi

FULL_TAG="${BASE_TAG}-${TAG_SUFFIX}"
echo "🔍 Detected architecture: $ARCH -> Building for $PLATFORM with tag :$FULL_TAG"
if [[ "$WITH_R_SUPPORT" == "true" ]]; then
echo "🔍 R support enabled for computing-unit-master"
fi

# Ensure Buildx is ready
docker buildx create --name texera-builder --use --bootstrap > /dev/null 2>&1 || docker buildx use texera-builder
Expand All @@ -72,7 +118,6 @@ cd "$(dirname "$0")"

# Auto-detect Dockerfiles in current directory
dockerfiles=( *.dockerfile )

if [[ ${#dockerfiles[@]} -eq 0 ]]; then
echo "❌ No Dockerfiles found (*.dockerfile) in the current directory."
exit 1
Expand All @@ -90,15 +135,25 @@ for dockerfile in "${dockerfiles[@]}"; do
fi

image="texera/$service_name:$FULL_TAG"

echo "👉 Building $image from $dockerfile"

docker buildx build \
--platform "$PLATFORM" \
-f "$dockerfile" \
-t "$image" \
--push \
..
# Add WITH_R_SUPPORT build arg for computing-unit-master
if [[ "$service_name" == "computing-unit-master" && "$WITH_R_SUPPORT" == "true" ]]; then
docker buildx build \
--platform "$PLATFORM" \
-f "$dockerfile" \
-t "$image" \
--build-arg WITH_R_SUPPORT=true \
--push \
..
else
docker buildx build \
--platform "$PLATFORM" \
-f "$dockerfile" \
-t "$image" \
--push \
..
fi
done

# Build pylsp service (directory: pylsp)
Expand All @@ -125,4 +180,4 @@ if should_build "y-websocket-server"; then
./y-websocket-server
fi

echo "✅ All images built and pushed with tag :$FULL_TAG"
echo "✅ All images built and pushed with tag :$FULL_TAG"
20 changes: 12 additions & 8 deletions bin/merge-image-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@
# specific language governing permissions and limitations
# under the License.


set -e

# Prompt for base tag
# Accept parameters from command line
DEFAULT_TAG="latest"
read -p "Enter the base tag to merge [${DEFAULT_TAG}]: " BASE_TAG
BASE_TAG=${BASE_TAG:-$DEFAULT_TAG}

# Prompt for which services' manifests to merge
DEFAULT_SERVICES="*"
read -p "Enter services to merge (comma-separated, '*' for all) [${DEFAULT_SERVICES}]: " SERVICES_INPUT
SERVICES_INPUT=${SERVICES_INPUT:-$DEFAULT_SERVICES}

BASE_TAG="${1:-$DEFAULT_TAG}"
SERVICES_INPUT="${2:-$DEFAULT_SERVICES}"

echo "Using base tag: $BASE_TAG"
echo "Services to merge: $SERVICES_INPUT"

# Convert input into array for lookup
IFS=',' read -ra SELECTED_SERVICES <<< "$SERVICES_INPUT"
Expand Down Expand Up @@ -82,3 +81,8 @@ for svc in "${services[@]}"; do

echo "✅ Created manifest: texera/$svc:$BASE_TAG"
done

echo ""
echo "=========================================="
echo "✅ All manifests merged successfully!"
echo "=========================================="
Loading