Spaces:
Sleeping
Sleeping
| FROM python:3.11-slim | |
| # Environment variables for HF deployment | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV SESSION_BACKEND=jwt | |
| ENV APP_ENV=production | |
| ENV PORT=7860 | |
| # Install system dependencies and debugging tools | |
| RUN apt-get update && apt-get install -y \ | |
| gcc \ | |
| g++ \ | |
| wget \ | |
| git \ | |
| curl \ | |
| procps \ | |
| htop \ | |
| nano \ | |
| vim \ | |
| net-tools \ | |
| lsof \ | |
| strace \ | |
| telnet \ | |
| netcat-openbsd \ | |
| tree \ | |
| less \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Create non-root user | |
| RUN useradd -m -u 1000 user && \ | |
| chown -R user:user /app | |
| USER user | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run the application with tee logging | |
| CMD ["sh", "-c", "python app.py 2>&1 | tee /tmp/app.log"] |