keyshift-api / Dockerfile
balakrishna567's picture
fix: bypass YouTube bot detection on HF Spaces
ee8a982
Raw
History Blame Contribute Delete
890 Bytes
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends curl ffmpeg libsndfile1 && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
# CPU-only torch (saves ~1.5GB vs default CUDA build)
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir \
fastapi "uvicorn[standard]" python-multipart \
librosa numpy scipy soundfile \
"transformers>=4.40.0" accelerate \
yt-dlp "nnAudio>=0.3.2"
COPY app/ app/
RUN useradd -m -u 1000 user && chown -R user:user /app
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HF_HOME=/home/user/.cache/huggingface
EXPOSE 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]