Spaces:
Running
Running
Update entrypoint.sh
Browse files- entrypoint.sh +12 -12
entrypoint.sh
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
#!/usr/bin/env bash
|
2 |
set -e
|
3 |
|
4 |
-
#
|
5 |
-
mkdir -p /tmp/
|
6 |
-
|
7 |
|
8 |
-
#
|
9 |
-
|
10 |
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
-
exec uvicorn app:app --host 0.0.0.0 --port 7860
|
17 |
-
|
18 |
-
# exec python /tmp/app.py
|
|
|
1 |
#!/usr/bin/env bash
|
2 |
set -e
|
3 |
|
4 |
+
# 1) Unpack the code into a writable overlay (tmpfs)
|
5 |
+
mkdir -p /tmp/runner
|
6 |
+
tar -xzf /app/app.tgz -C /tmp/runner # gives /tmp/runner/app.pyc
|
7 |
|
8 |
+
# 2) Run Python on that copy
|
9 |
+
python /tmp/runner/app.pyc &
|
10 |
|
11 |
+
PID=$!
|
12 |
+
# 3) Wait a moment, then unlink the byte-code and the tarball itself
|
13 |
+
sleep 2
|
14 |
+
rm -f /tmp/runner/app.pyc /app/app.tgz
|
15 |
+
echo "[entrypoint] Code deleted"
|
16 |
|
17 |
+
# 4) Reap the process
|
18 |
+
wait $PID
|
|
|
|
|
|