Spaces:
Paused
Paused
Soham Waghmare
commited on
Commit
·
eae3286
1
Parent(s):
63ec0ab
chore
Browse files- Dockerfile +7 -1
- nginx.conf +46 -0
- start.sh +5 -3
Dockerfile
CHANGED
|
@@ -36,7 +36,8 @@ RUN apt install -y libnss3\
|
|
| 36 |
libgbm1\
|
| 37 |
libxkbcommon0\
|
| 38 |
libasound2\
|
| 39 |
-
libatspi2.0-0
|
|
|
|
| 40 |
USER user
|
| 41 |
|
| 42 |
# ---------- Frontend ----------
|
|
@@ -65,5 +66,10 @@ RUN bun run build
|
|
| 65 |
|
| 66 |
WORKDIR /app
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
RUN chmod +x /app/start.sh
|
| 69 |
CMD ["/app/start.sh"]
|
|
|
|
| 36 |
libgbm1\
|
| 37 |
libxkbcommon0\
|
| 38 |
libasound2\
|
| 39 |
+
libatspi2.0-0\
|
| 40 |
+
nginx
|
| 41 |
USER user
|
| 42 |
|
| 43 |
# ---------- Frontend ----------
|
|
|
|
| 66 |
|
| 67 |
WORKDIR /app
|
| 68 |
|
| 69 |
+
# ---------- Nginx ----------
|
| 70 |
+
USER root
|
| 71 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 72 |
+
USER user
|
| 73 |
+
|
| 74 |
RUN chmod +x /app/start.sh
|
| 75 |
CMD ["/app/start.sh"]
|
nginx.conf
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
worker_processes 1;
|
| 2 |
+
events { worker_connections 1024; }
|
| 3 |
+
|
| 4 |
+
http {
|
| 5 |
+
include mime.types;
|
| 6 |
+
default_type application/octet-stream;
|
| 7 |
+
|
| 8 |
+
# Upstream for your backend Socket.IO server
|
| 9 |
+
upstream backend_socketio {
|
| 10 |
+
server 127.0.0.1:5000;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
# Upstream for your frontend Next.js server
|
| 14 |
+
upstream frontend_nextjs {
|
| 15 |
+
server 127.0.0.1:3001;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
server {
|
| 19 |
+
listen 3000;
|
| 20 |
+
|
| 21 |
+
# Proxy /socket.io/ requests to backend on port 5000
|
| 22 |
+
location /socket.io/ {
|
| 23 |
+
proxy_pass http://backend_socketio;
|
| 24 |
+
proxy_http_version 1.1;
|
| 25 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 26 |
+
proxy_set_header Connection "upgrade";
|
| 27 |
+
proxy_set_header Host $host;
|
| 28 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 29 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 30 |
+
proxy_cache_bypass $http_upgrade;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
# Serve the frontend Next.js app
|
| 34 |
+
location / {
|
| 35 |
+
proxy_pass http://frontend_nextjs;
|
| 36 |
+
proxy_http_version 1.1;
|
| 37 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 38 |
+
proxy_set_header Connection 'upgrade';
|
| 39 |
+
proxy_set_header Host $host;
|
| 40 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 41 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 42 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 43 |
+
proxy_cache_bypass $http_upgrade;
|
| 44 |
+
}
|
| 45 |
+
}
|
| 46 |
+
}
|
start.sh
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
| 2 |
cd /app/frontend
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
uv run app.py
|
| 6 |
wait
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
cd /app/backend
|
| 4 |
+
uv run app.py &
|
| 5 |
cd /app/frontend
|
| 6 |
+
PORT=3001 bunx serve@latest out &
|
| 7 |
+
nginx -g "daemon off;" &
|
|
|
|
| 8 |
wait
|