mfoud444 commited on
Commit
42cccb9
1 Parent(s): 8618a6b
Files changed (4) hide show
  1. Dockerfile +20 -0
  2. nginx.conf +35 -0
  3. run.sh +15 -6
  4. static / index.html +1 -0
Dockerfile CHANGED
@@ -5,6 +5,23 @@ RUN pip install --upgrade pip
5
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
6
  RUN pip install -U g4f
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  # RUN pip install browser_cookie3
9
  # RUN pip install g4f[webdriver]
10
  # RUN pip install -U g4f
@@ -133,6 +150,9 @@ USER root
133
  # RUN chown -R user /usr/bin/chromedriver
134
 
135
  USER user
 
136
  RUN echo "Chrome: " && google-chrome --version
 
 
137
  WORKDIR $HOME/app/randapi/randai
138
  CMD [ "python", "manage.py", "runserver", "0.0.0.0:7860", "--settings=randai.settings" ]
 
5
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
6
  RUN pip install -U g4f
7
 
8
+
9
+
10
+
11
+
12
+ RUN apt-get -y update && apt-get -y install nginx
13
+
14
+ RUN mkdir -p /var/cache/nginx \
15
+ /var/log/nginx \
16
+ /var/lib/nginx
17
+ RUN touch /var/run/nginx.pid
18
+
19
+ RUN chown -R pn:pn /var/cache/nginx \
20
+ /var/log/nginx \
21
+ /var/lib/nginx \
22
+ /var/run/nginx.pid
23
+
24
+
25
  # RUN pip install browser_cookie3
26
  # RUN pip install g4f[webdriver]
27
  # RUN pip install -U g4f
 
150
  # RUN chown -R user /usr/bin/chromedriver
151
 
152
  USER user
153
+ COPY --chown=user nginx.conf /etc/nginx/sites-available/default
154
  RUN echo "Chrome: " && google-chrome --version
155
+ RUN bash u.sh
156
+ # CMD ["bash", "run.sh"]
157
  WORKDIR $HOME/app/randapi/randai
158
  CMD [ "python", "manage.py", "runserver", "0.0.0.0:7860", "--settings=randai.settings" ]
nginx.conf ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 4444 default_server;
3
+ listen [::]:4444 default_server;
4
+
5
+ server_name _;
6
+
7
+ location / {
8
+
9
+ proxy_pass http://localhost:7860;
10
+ proxy_http_version 1.1;
11
+ proxy_set_header Upgrade $http_upgrade;
12
+ proxy_set_header Connection 'upgrade';
13
+ proxy_set_header Host $host;
14
+ proxy_set_header X-Real-IP $remote_addr;
15
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16
+ proxy_cache_bypass $http_upgrade;
17
+ proxy_read_timeout 86400;
18
+ proxy_redirect off;
19
+ }
20
+
21
+ location /static/ {
22
+ # Serve backend from port
23
+ rewrite /static/(.*) /$1 break;
24
+ proxy_pass http://localhost:8000;
25
+ proxy_http_version 1.1;
26
+ proxy_set_header Upgrade $http_upgrade;
27
+ proxy_set_header Connection 'upgrade';
28
+ proxy_set_header Host $host;
29
+ proxy_set_header X-Real-IP $remote_addr;
30
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
31
+ proxy_cache_bypass $http_upgrade;
32
+ proxy_read_timeout 86400;
33
+ proxy_redirect off;
34
+ }
35
+ }
run.sh CHANGED
@@ -1,7 +1,16 @@
1
  #!/bin/bash
2
- cd randai
3
- #pip install -U g4f
4
- python manage.py makemigrations
5
- python manage.py migrate
6
- python manage.py runserver
7
- #python manage.py runserver 10.2.99.12:8000
 
 
 
 
 
 
 
 
 
 
1
  #!/bin/bash
2
+
3
+ service nginx start
4
+ python -m http.server --directory ./static --bind 0.0.0.0 8000 & echo $! > http_server.pid
5
+ python manage.py runserver 0.0.0.0:7860
6
+ pkill -F http_server.pid
7
+ rm http_server.pid
8
+
9
+
10
+ # #!/bin/bash
11
+ # cd randai
12
+ # #pip install -U g4f
13
+ # python manage.py makemigrations
14
+ # python manage.py migrate
15
+ # python manage.py runserver
16
+ # #python manage.py runserver 10.2.99.12:8000
static / index.html ADDED
@@ -0,0 +1 @@
 
 
1
+ hello