Spaces:
Sleeping
Sleeping
| # Use a lightweight Python image | |
| FROM python:3.11-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies in one layer | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| tesseract-ocr \ | |
| tesseract-ocr-tam \ | |
| fonts-liberation \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements.txt and install Python packages | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app files | |
| COPY app.py image_fetcher.py video.py video2.py ./ | |
| # Create directories with full permissions | |
| RUN mkdir -p /tmp/images /tmp/sound /tmp/video && chmod -R 777 /tmp/images /tmp/sound /tmp/video | |
| # Expose port | |
| EXPOSE 7860 | |
| # Run as non-root user for safety | |
| RUN useradd -m appuser | |
| USER appuser | |
| # Start the app | |
| CMD ["python", "app.py"] |