File size: 3,375 Bytes
bdc51e7
91752ba
 
 
 
 
 
 
 
 
 
 
 
 
bdc51e7
39e3b45
 
6b4b64a
 
c7e8d66
 
 
9795d6f
19e95b7
39e3b45
 
daee21c
 
 
 
c56283d
a6685eb
39e3b45
 
9795d6f
39e3b45
 
 
 
 
 
 
 
 
 
 
 
 
f1ae899
 
 
 
 
8306cea
f1ae899
40aa0b9
 
 
 
 
 
f8b6945
 
 
 
 
39e3b45
bdc51e7
 
b995a8e
c7e8d66
 
 
39e3b45
a6685eb
bccc266
a3a3ef4
c7e8d66
bdc51e7
f007a4b
3b36ca2
 
f007a4b
3b36ca2
91752ba
f007a4b
3b36ca2
 
e00b510
 
f007a4b
3b36ca2
e00b510
 
 
91752ba
 
a6685eb
c7e8d66
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# 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"]