atonyxu
commited on
Commit
·
4cbbf07
1
Parent(s):
d9d4cb0
code
Browse files- Dockerfile +2 -0
- main.py +7 -0
- start_server.sh +6 -19
Dockerfile
CHANGED
@@ -15,6 +15,8 @@ RUN rm -f /etc/apt/sources.list.d/*.list && \
|
|
15 |
aria2 \
|
16 |
axel \
|
17 |
procps \
|
|
|
|
|
18 |
git-lfs \
|
19 |
zip \
|
20 |
unzip \
|
|
|
15 |
aria2 \
|
16 |
axel \
|
17 |
procps \
|
18 |
+
fastapi \
|
19 |
+
uvicorn \
|
20 |
git-lfs \
|
21 |
zip \
|
22 |
unzip \
|
main.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
|
3 |
+
app = FastAPI()
|
4 |
+
|
5 |
+
@app.get("/")
|
6 |
+
def read_root():
|
7 |
+
return {"message": "Hello, World!"}
|
start_server.sh
CHANGED
@@ -1,29 +1,16 @@
|
|
1 |
#!/bin/bash
|
2 |
JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
3 |
-
nohup code-server --bind-addr 0.0.0.0:8080 /data
|
4 |
sleep 5s
|
5 |
ps aux | grep 'code-server' | grep -v 'grep' | awk '{print $2}' | xargs kill -9
|
6 |
sed -i '/password/d' /home/user/.config/code-server/config.yaml
|
7 |
-
echo "password: ${JUPYTER_TOKEN}"
|
8 |
cat /home/user/.config/code-server/config.yaml
|
9 |
|
10 |
NOTEBOOK_DIR="/data"
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
--no-browser \
|
18 |
-
--allow-root \
|
19 |
-
--ServerApp.token="$JUPYTER_TOKEN" \
|
20 |
-
--ServerApp.tornado_settings="{'headers': {'Content-Security-Policy': 'frame-ancestors *'}}" \
|
21 |
-
--ServerApp.cookie_options="{'SameSite': 'None', 'Secure': True}" \
|
22 |
-
--ServerApp.disable_check_xsrf=True \
|
23 |
-
--LabApp.news_url=None \
|
24 |
-
--LabApp.check_for_updates_class="jupyterlab.NeverCheckForUpdate" \
|
25 |
-
--notebook-dir=$NOTEBOOK_DIR > /data/jupyter.log 2>&1 &
|
26 |
-
|
27 |
-
sleep 10s
|
28 |
-
ps aux | grep 'jupyter' | grep -v 'grep' | awk '{print $2}' | xargs kill -9
|
29 |
-
code-server --bind-addr 0.0.0.0:8080 /data > /data/start.log 2>&1 &
|
|
|
1 |
#!/bin/bash
|
2 |
JUPYTER_TOKEN="${JUPYTER_TOKEN:=huggingface}"
|
3 |
+
nohup code-server --bind-addr 0.0.0.0:8080 /data >/tmp/code.log 2>&1 &
|
4 |
sleep 5s
|
5 |
ps aux | grep 'code-server' | grep -v 'grep' | awk '{print $2}' | xargs kill -9
|
6 |
sed -i '/password/d' /home/user/.config/code-server/config.yaml
|
7 |
+
echo "password: ${JUPYTER_TOKEN}" >>/home/user/.config/code-server/config.yaml
|
8 |
cat /home/user/.config/code-server/config.yaml
|
9 |
|
10 |
NOTEBOOK_DIR="/data"
|
11 |
|
12 |
+
nohup uvicorn main:app --host 0.0.0.0 --port 8080 >/data/start.log 2>&1 &
|
13 |
|
14 |
+
sleep 20s
|
15 |
+
ps aux | grep 'uvicorn' | grep -v 'grep' | awk '{print $2}' | xargs kill -9
|
16 |
+
code-server --bind-addr 0.0.0.0:8080 /data >/data/start.log 2>&1 &
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|