nodeenv is a Python package that downloads a pre-built Node.js binary — no apt repos, no compilation, guaranteed to work in python:3.12-slim. The 'node' binary is linked into /usr/local/bin so yt-dlp can find it. With Node.js available the web client works fully (37 formats) and can solve YouTube's n-challenge that every other approach was failing on. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
789 B
Docker
24 lines
789 B
Docker
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y ffmpeg gosu && rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY backend/requirements.txt ./backend/requirements.txt
|
|
RUN pip install --no-cache-dir -r backend/requirements.txt && pip install --no-cache-dir -U yt-dlp
|
|
|
|
# nodeenv downloads a pre-built Node.js binary via pip — no apt repos needed.
|
|
# yt-dlp needs 'node' in PATH to solve YouTube's n-challenge (JS obfuscation).
|
|
RUN pip install --no-cache-dir nodeenv && \
|
|
nodeenv --prebuilt /opt/node && \
|
|
ln -sf /opt/node/bin/node /usr/local/bin/node
|
|
|
|
RUN echo "--cache-dir /data/yt-dlp-cache" > /etc/yt-dlp.conf
|
|
|
|
COPY backend/ ./backend/
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["/app/backend/entrypoint.sh"]
|
|
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
|