# Use an official Python runtime as a parent image FROM python:3.12-slim # Set the working directory in the container to /app WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ curl \ && rm -rf /var/lib/apt/lists/* # Create bin directory and download mp4decrypt RUN mkdir -p /app/bin && \ curl -o /app/bin/mp4decrypt https://raw.githubusercontent.com/shubhamakshit/pwdlv3_assets/main/GNU/Linux/x86_64/mp4decrypt && \ chmod +x /app/bin/mp4decrypt # Add /app/bin to PATH ENV PATH="/app/bin:$PATH" # Copy requirements first for better caching COPY requirements.txt . # Install Python dependencies including gunicorn RUN pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir gunicorn # Copy the rest of the application COPY . . # Make sure /app is writable (after copying files) RUN chmod -R 777 /app && \ mkdir -p /app/webdl && \ chmod 777 /app/webdl # Expose port 7860 for HuggingFace Spaces EXPOSE 7860 # Run the application with gunicorn CMD ["gunicorn", "--bind", "0.0.0.0:7860","--timeout", "120", "beta.api.api:app"]