# Use a full Ubuntu base for a complete, unrestricted Linux environment FROM ubuntu:22.04 # 1. Install System Dependencies (curl, git, build-essential, nano, htop, etc.) USER root RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ python3 \ python3-pip \ python3-venv \ curl \ git \ sudo \ wget \ nano \ htop \ build-essential \ libssl-dev \ libffi-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # 2. Create non-root user and grant passwordless SUDO (No Restrictions!) RUN adduser --disabled-password --gecos '' user \ && echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers RUN mkdir -p /home/user/app && chown -R user:user /home/user/app # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 WORKDIR $HOME/app # 3. Setup Python Environment USER user RUN python3 -m pip install --upgrade pip # 4. Copy Files and Set Permissions COPY --chown=user:user . . # 5. Install Python Requirements RUN pip3 install --no-cache-dir -r requirements.txt # 6. Create Persistent Directories inside WORKDIR RUN mkdir -p sessions downloads && chmod -R 777 sessions downloads # 7. Final Script Setup RUN chmod +x start.sh # Hugging Face Spaces port EXPOSE 7860 ENTRYPOINT ["./start.sh"]