Spaces:
Running
Running
| # Minimal Docker image for CMPE343 Competition | |
| # Only allows basic data science packages: numpy, pandas, matplotlib, seaborn, scikit-learn | |
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PIP_NO_CACHE_DIR=1 | |
| ENV PIP_DISABLE_PIP_VERSION_CHECK=1 | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user for security | |
| RUN groupadd -r competition && useradd -r -g competition competition | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements files | |
| COPY requirements.txt /app/ | |
| COPY team_requirements.txt /app/ | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . /app/ | |
| # Create directories for teams and state | |
| RUN mkdir -p /app/anonymized_teams /app/state && \ | |
| chown -R competition:competition /app | |
| # Switch to non-root user | |
| USER competition | |
| # Expose port | |
| EXPOSE 7860 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ | |
| CMD curl -f http://localhost:7860/ || exit 1 | |
| # Default command | |
| CMD ["python", "app.py"] | |