# Use a lightweight Python base FROM python:3.9-slim # Set working directory WORKDIR /app # 1. Install System Dependencies # We need 'wget' to download unrar RUN apt-get update && apt-get install -y \ wget \ && rm -rf /var/lib/apt/lists/* # 2. Install Official Unrar (Required for rarfile library to work correctly) # Downloading 'rarlinux-x64.tar.gz' ensures we get the latest version and avoids 404 errors on old versions RUN wget https://www.rarlab.com/rar/rarlinux-x64-720b3.tar.gz && \ tar -zxvf rarlinux-x64-720b3.tar.gz && \ cp rar/unrar /usr/bin/unrar && \ cp rar/rar /usr/bin/rar && \ chmod 755 /usr/bin/unrar && \ rm -rf rar rarlinux-x64-720b3.tar.gz # 3. Copy Requirements COPY requirements.txt . # 4. Install Python Dependencies RUN pip install --no-cache-dir -r requirements.txt # 5. Copy Application Code COPY . . # 6. Expose Port EXPOSE 8000 # 7. Run Uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]