Skip to content
Draft
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
31 changes: 23 additions & 8 deletions metro-ai-suite/metro-vision-ai-app-recipe/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,37 @@ else
echo "HOST_IP=$HOST_IP" >> "$ENV_FILE"
fi

# Extract SAMPLE_APP variable from .env file
# Extract SAMPLE_APP variable from .env file to ensure consistency
SAMPLE_APP=$(grep -E "^SAMPLE_APP=" "$ENV_FILE" | cut -d '=' -f2 | tr -d '"' | tr -d "'")

# Bring down the application before updating docker compose file
if docker compose ps >/dev/null 2>&1; then
echo "Bringing down any running containers..."
docker compose down
# Validate that SAMPLE_APP was set correctly
if [ -z "$SAMPLE_APP" ]; then
echo "Error: SAMPLE_APP not found in .env file."
exit 1
fi

# Copy appropriate docker-compose file
# Determine appropriate docker-compose file based on SAMPLE_APP
if [ "$SAMPLE_APP" = "smart-intersection" ]; then
cp compose-scenescape.yml docker-compose.yml
RI_COMPOSE_FILE_ARG="compose-scenescape.yml"
else
cp compose-without-scenescape.yml docker-compose.yml
RI_COMPOSE_FILE_ARG="compose-without-scenescape.yml"
fi

# Check if the compose file exists
if [ ! -f "$RI_COMPOSE_FILE_ARG" ]; then
echo "Error: Compose file $RI_COMPOSE_FILE_ARG not found."
exit 1
fi

# Bring down the application before updating docker compose file
if docker compose -f "$RI_COMPOSE_FILE_ARG" ps >/dev/null 2>&1; then
echo "Bringing down any running containers..."
docker compose -f "$RI_COMPOSE_FILE_ARG" down
fi

# Copy appropriate docker-compose file
cp "$RI_COMPOSE_FILE_ARG" docker-compose.yml

# Check if the directory exists
if [ ! -d "$SAMPLE_APP" ]; then
echo "Error: Directory $SAMPLE_APP does not exist."
Expand Down