#!/bin/bash # Docker entrypoint script for CMPE343 Competition set -e echo "🚀 Starting CMPE343 Competition Environment..." # Check if anonymized teams exist if [ ! -d "/app/anonymized_teams" ] || [ -z "$(ls -A /app/anonymized_teams)" ]; then echo "⚠️ No anonymized teams found. Running anonymization script..." python /app/anonymize_repos.py || echo "❌ Anonymization failed, continuing with existing setup..." fi # Ensure state directory exists mkdir -p /app/state # Check if models.yaml exists if [ ! -f "/app/models.yaml" ]; then echo "❌ models.yaml not found. Please ensure it exists." exit 1 fi # Validate team directories echo "🔍 Validating team directories..." for team_dir in /app/anonymized_teams/*/; do if [ -d "$team_dir" ]; then team_name=$(basename "$team_dir") echo " ✓ Found team: $team_name" # Check if recommender.py exists if [ ! -f "$team_dir/src/recommender.py" ]; then echo " ⚠️ Warning: $team_name/src/recommender.py not found" fi fi done # Install team requirements if they exist if [ -f "/app/team_requirements.txt" ]; then echo "📦 Installing team requirements..." pip install --no-cache-dir -r /app/team_requirements.txt fi # Set proper permissions chown -R competition:competition /app/state /app/anonymized_teams echo "✅ Environment ready. Starting Gradio application..." # Start the application exec "$@"