File size: 1,174 Bytes
df4a9b4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
aria2 \
p7zip-full \
git \
git-lfs \
build-essential \
&& git lfs install \
&& rm -rf /var/lib/apt/lists/*
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Set working directory to the user's home directory
WORKDIR /app
# Copy requirements first
COPY requirements.txt .
# Install Python dependencies as the new user
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY --chown=user . .
# Create necessary directories and set permissions
RUN mkdir -p downloads tmp tools cookies data sessions && \
chown -R user:user /app && \
chmod -R 777 /app/downloads /app/tmp /app/cookies /app/data /app/sessions
# Switch to the "user" user
USER user
# Set environment variables
ENV PYTHONUNBUFFERED=1
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Command to run the bot: Start Aria2 daemon and then the Python bot
CMD aria2c --enable-rpc --rpc-listen-all=false --rpc-listen-port=6800 --daemon && python main.py
|