Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +46 -0
Dockerfile
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# filename: Dockerfile
|
| 2 |
+
|
| 3 |
+
# --- Base Image: Use a lightweight, official Python image ---
|
| 4 |
+
FROM python:3.11-slim
|
| 5 |
+
|
| 6 |
+
# --- Set Environment Variables ---
|
| 7 |
+
# This prevents Python from buffering output, making logs appear in real-time.
|
| 8 |
+
ENV PYTHONUNBUFFERED 1
|
| 9 |
+
# Set the timezone for India to ensure logs and timestamps are correct.
|
| 10 |
+
ENV TZ=Asia/Kolkata
|
| 11 |
+
|
| 12 |
+
# --- Install System Dependencies ---
|
| 13 |
+
# Update package lists and install necessary tools, including FFMPEG for video processing.
|
| 14 |
+
RUN apt-get update && \
|
| 15 |
+
apt-get install -y --no-install-recommends \
|
| 16 |
+
build-essential \
|
| 17 |
+
ffmpeg \
|
| 18 |
+
curl \
|
| 19 |
+
wget \
|
| 20 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 21 |
+
|
| 22 |
+
# --- Set Up Application Directory ---
|
| 23 |
+
WORKDIR /app
|
| 24 |
+
|
| 25 |
+
# --- Install Python Dependencies ---
|
| 26 |
+
# Copy the requirements file first to leverage Docker's layer caching.
|
| 27 |
+
# This step will only re-run if requirements.txt changes.
|
| 28 |
+
COPY requirements.txt .
|
| 29 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 30 |
+
pip install --no-cache-dir -r requirements.txt
|
| 31 |
+
|
| 32 |
+
# --- Copy Application Code ---
|
| 33 |
+
# Copy all the project files into the working directory inside the container.
|
| 34 |
+
COPY . .
|
| 35 |
+
|
| 36 |
+
# --- Create necessary directories for runtime data ---
|
| 37 |
+
RUN mkdir -p ./downloads ./logs ./data && \
|
| 38 |
+
chmod -R 777 ./downloads ./logs ./data
|
| 39 |
+
|
| 40 |
+
# --- Expose Port ---
|
| 41 |
+
# Inform Docker that the application listens on port 8080 (used by Uvicorn in main.py).
|
| 42 |
+
EXPOSE 8080
|
| 43 |
+
|
| 44 |
+
# --- Final Command ---
|
| 45 |
+
# The command to run when the container starts. This executes your main application.
|
| 46 |
+
CMD ["python", "main.py"]
|