# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # FROM python:3.9 # RUN useradd -m -u 1000 user # USER user # ENV PATH="/home/user/.local/bin:$PATH" # WORKDIR /app # COPY --chown=user ./requirements.txt requirements.txt # RUN pip install --no-cache-dir --upgrade -r requirements.txt # COPY --chown=user . /app # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] FROM ubuntu:latest ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y build-essential libffi-dev libssl-dev \ libx11-6 libxext6 libxrender-dev libxrandr-dev x11-utils \ libxtst-dev libxi-dev libgl1 git curl procps sudo vim fish && \ curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ apt-get install -y nodejs RUN id -u ubuntu >/dev/null 2>&1 || useradd -m -s /usr/bin/fish ubuntu && \ usermod -s /usr/bin/fish ubuntu && \ echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers RUN apt-get install cmatrix -y || echo error RUN mkdir -p /run/demonss/ && cd /run/demonss/ && npm install node-pty && npm install ws RUN cd /run/demonss/ && npm install express && npm install http-proxy-middleware RUN echo "#!/bin/bash\nclear" > /bin/c && chmod 777 /bin/c RUN chmod u+s /usr/bin/apt /usr/bin/apt-get /usr/bin/dpkg && \ chmod -R 777 /var/lib/dpkg /var/cache/apt /var/lib/apt /etc/apt /var/log /var/cache/debconf && \ touch /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend \ /var/lib/apt/lists/lock /var/cache/apt/archives/lock \ /var/cache/debconf/passwords.dat && \ chmod 666 /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend \ /var/lib/apt/lists/lock /var/cache/apt/archives/lock \ /var/cache/debconf/passwords.dat && \ mkdir -p /etc/apt/trusted.gpg.d && \ touch /etc/apt/trusted.gpg && \ chmod -R 777 /etc/apt/trusted.gpg.d /etc/apt/trusted.gpg RUN chmod u+s /usr/bin/apt /usr/bin/apt-get /usr/bin/dpkg && \ chmod -R 777 /var/lib/dpkg /var/cache/apt /var/lib/apt /etc/apt /var/log /var/cache/debconf && \ mkdir -p /var/log/apt && chmod -R 777 /var/log/apt && \ touch /var/log/apt/history.log /var/log/apt/term.log && chmod 666 /var/log/apt/*.log && \ touch /var/cache/debconf/passwords.dat && chmod 666 /var/cache/debconf/passwords.dat && \ touch /etc/apt/trusted.gpg && chmod 777 /etc/apt/trusted.gpg && chmod 777 /var/log/apt/term.log RUN chmod 777 -R /etc/nix/ || echo errr RUN chmod 777 -R /etc/ || echo errr RUN chmod 777 -R /var/ || echo errr RUN chmod 777 -R /bin/ || echo errr RUN chmod 777 -R /home/ || echo errr RUN apt-get update && apt-get install -y python3-pip || echo RUN apt-get update && apt-get install -y \ curl \ xz-utils \ git USER root WORKDIR /app RUN npm install -g node-pty ws COPY . . RUN cp /app/server.js /run/demonss/server.js RUN cp /app/s.js /run/demonss/s.js RUN cp /app/start.sh /run/demonss/start.sh EXPOSE 7860 # RUN useradd -m -s /bin/bash user # RUN echo 'user:123' | chpasswd RUN mkdir -m 0777 /nix && chown ubuntu /nix RUN chmod 777 /run/demonss/start.sh USER ubuntu WORKDIR /home/ubuntu RUN curl -L https://nixos.org/nix/install | sh -s -- --no-daemon ENV PATH="/home/ubuntu/.nix-profile/bin:/home/ubuntu/.nix-profile/sbin:/home/ubuntu/.nix-defexpr/channels/bin:$PATH" RUN nix-env -iA nixpkgs.gcc nixpkgs.vim CMD ["bash", "/run/demonss/start.sh"]