File size: 1,464 Bytes
7f8c6a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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 "$@"