FROM python:3.9-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ libglib2.0-dev \ libssl-dev \ libcurl4-openssl-dev \ meson \ ninja-build \ git \ curl \ sqlite3 \ --no-install-recommends && \ rm -rf /var/lib/apt/lists/* # Install Node.js RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs # Clone and build megatools RUN git clone https://xff.cz/git/megatools && \ cd megatools && \ meson setup build && \ ninja -C build && \ ninja -C build install && \ cd .. && rm -rf megatools # Copy and install Python requirements COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy frontend files and build COPY frontend/package*.json ./frontend/ WORKDIR /app/frontend RUN npm install --omit=dev COPY frontend/public ./public COPY frontend/src ./src RUN npm run build && \ # Remove node_modules after build to save space rm -rf node_modules # Copy backend files WORKDIR /app COPY *.py ./ COPY providers ./providers/ # Create HF user and set permissions efficiently RUN useradd -m -u 1000 user && \ mkdir -p /tmp/vod-archiver && \ chown -R 1000:1000 /app /tmp/vod-archiver USER user EXPOSE 7860 CMD ["python", "app.py"]