Spaces:
Paused
Paused
Update entrypoint.sh
Browse files- entrypoint.sh +8 -8
entrypoint.sh
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
set -e
|
| 3 |
|
| 4 |
-
# 1) Unpack
|
| 5 |
mkdir -p /tmp/runner
|
| 6 |
-
tar -xzf /app/app.tgz -C /tmp/runner
|
| 7 |
|
| 8 |
-
# 2)
|
| 9 |
python /tmp/runner/app.pyc &
|
| 10 |
-
|
| 11 |
PID=$!
|
| 12 |
-
|
|
|
|
| 13 |
sleep 2
|
| 14 |
rm -f /tmp/runner/app.pyc /app/app.tgz
|
| 15 |
-
echo "[entrypoint]
|
| 16 |
|
| 17 |
-
# 4)
|
| 18 |
-
wait $PID
|
|
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
set -e
|
| 3 |
|
| 4 |
+
# 1) Unpack byte-code into a writable tmpfs layer
|
| 5 |
mkdir -p /tmp/runner
|
| 6 |
+
tar -xzf /app/app.tgz -C /tmp/runner # -> /tmp/runner/app.pyc
|
| 7 |
|
| 8 |
+
# 2) Start the service from that copy
|
| 9 |
python /tmp/runner/app.pyc &
|
|
|
|
| 10 |
PID=$!
|
| 11 |
+
|
| 12 |
+
# 3) After a short grace period, delete both the unpacked .pyc and the tarball
|
| 13 |
sleep 2
|
| 14 |
rm -f /tmp/runner/app.pyc /app/app.tgz
|
| 15 |
+
echo "[entrypoint] byte-code deleted"
|
| 16 |
|
| 17 |
+
# 4) Re-attach to the service
|
| 18 |
+
wait "$PID"
|