Spaces:
Runtime error
Runtime error
| # filename: Dockerfile | |
| # --- Base Image: Use a lightweight, official Python image --- | |
| FROM python:3.11-slim | |
| # --- Set Environment Variables --- | |
| # This prevents Python from buffering output, making logs appear in real-time. | |
| ENV PYTHONUNBUFFERED 1 | |
| # Set the timezone for India to ensure logs and timestamps are correct. | |
| ENV TZ=Asia/Kolkata | |
| # --- Install System Dependencies --- | |
| # Update package lists and install necessary tools, including FFMPEG for video processing. | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| ffmpeg \ | |
| curl \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # --- Set Up Application Directory --- | |
| WORKDIR /app | |
| # --- Install Python Dependencies --- | |
| # Copy the requirements file first to leverage Docker's layer caching. | |
| # This step will only re-run if requirements.txt changes. | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # --- Copy Application Code --- | |
| # Copy all the project files into the working directory inside the container. | |
| COPY . . | |
| # --- Create necessary directories for runtime data --- | |
| RUN mkdir -p ./downloads ./logs ./data && \ | |
| chmod -R 777 ./downloads ./logs ./data | |
| # --- Expose Port --- | |
| # Inform Docker that the application listens on port 8080 (used by Uvicorn in main.py). | |
| EXPOSE 8080 | |
| # --- Final Command --- | |
| # The command to run when the container starts. This executes your main application. | |
| CMD ["python", "main.py"] | |