# Start from a clean, official Python 3.10 base image | |
FROM python:3.10-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependency ffmpeg, which moviepy needs | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
ffmpeg \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy ONLY the requirements file first to leverage Docker's cache | |
COPY requirements.txt . | |
# Install all Python dependencies from the requirements file in one single, clean step | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Pre-download the OpenAI Whisper model to prevent runtime timeouts | |
RUN python -c "import whisper; whisper.load_model('base')" | |
# Now, copy the rest of your application code into the container | |
COPY . . | |
# Expose the port that Gradio will run on (default is 7860) | |
EXPOSE 7860 | |
# Set the command to run your Gradio application | |
CMD ["python", "app.py"] |