RenanOF commited on
Commit
2fcb6ce
·
verified ·
1 Parent(s): 36383f8

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile (1) +32 -0
  2. nginx (1).conf +23 -0
  3. run (1).sh +6 -0
Dockerfile (1) ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu
2
+
3
+ # Based on https://huggingface.co/spaces/radames/nginx-gradio-reverse-proxy/blob/main/Dockerfile
4
+ USER root
5
+
6
+ RUN apt-get -y update && apt-get -y install nginx
7
+ RUN mkdir -p /var/cache/nginx \
8
+ /var/log/nginx \
9
+ /var/lib/nginx
10
+ RUN touch /var/run/nginx.pid
11
+
12
+ # Ubuntu 24.04 includes ubuntu with uid 1000
13
+ RUN userdel -r ubuntu
14
+ RUN chown -R 1000:1000 /var/cache/nginx \
15
+ /var/log/nginx \
16
+ /var/lib/nginx \
17
+ /var/run/nginx.pid
18
+
19
+ RUN useradd -m -u 1000 user
20
+
21
+ USER user
22
+ ENV HOME=/home/user
23
+
24
+ RUN mkdir $HOME/app
25
+ WORKDIR $HOME/app
26
+
27
+ # Copy nginx configuration
28
+ COPY --chown=user nginx.conf /etc/nginx/sites-available/default
29
+ COPY --chown=user . .
30
+
31
+ CMD ["bash", "run.sh"]
32
+
nginx (1).conf ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 7860 default_server;
3
+ listen [::]:7860 default_server;
4
+
5
+ root /usr/share/nginx/html;
6
+ index index.html index.htm;
7
+
8
+ server_name _;
9
+ location / {
10
+ proxy_pass http://API_URL;
11
+ proxy_set_header Host API_URL;
12
+ proxy_set_header X-Real-IP $remote_addr;
13
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14
+ #proxy_set_header X-Forwarded-Proto $scheme;
15
+ proxy_set_header X-Forwarded-Proto http;
16
+ proxy_set_header X-Forwarded-Ssl off;
17
+ proxy_set_header X-Url-Scheme http;
18
+ proxy_buffering off;
19
+ proxy_http_version 1.1;
20
+ proxy_set_header Upgrade $http_upgrade;
21
+ proxy_set_header Connection "upgrade";
22
+ }
23
+ }
run (1).sh ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Careful: can't create tmp files from this script
4
+ cat nginx.conf | sed "s|API_URL|${API_URL}|g" > /etc/nginx/sites-available/default
5
+ service nginx start
6
+ sleep infinity