Spaces:
Build error
Build error
FROM python:3.9-slim | |
# System dependencies | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential gcc libffi-dev libpq-dev curl gnupg ca-certificates && \ | |
apt-get clean && rm -rf /var/lib/apt/lists/* | |
# Install Node.js (v18) | |
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
apt-get install -y nodejs && \ | |
node -v && npm -v | |
# Set workdir | |
WORKDIR /app | |
# Copy requirements and install Python deps | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy Node.js files and install npm deps | |
COPY test.js ./ | |
RUN npm install youtube-po-token-generator | |
# Create cache dir for pytubefix/pytube (owned by root by default) | |
RUN mkdir -p /app/cache && chmod 755 /app/cache | |
# Create logs.json with permissions | |
RUN touch logs.json && chmod 664 logs.json | |
# -- DO NOT create or switch user, run as root -- | |
# Set environment variables | |
ENV PYTUBE_CACHE_DIR=/app/cache | |
ENV PATH="/root/.local/bin:$PATH" | |
# Expose port | |
EXPOSE 7860 | |
# Start app | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"] |