Spaces:
Paused
Paused
Update entrypoint.sh
Browse files- entrypoint.sh +14 -14
entrypoint.sh
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
-
set -
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
PID=$!
|
| 14 |
|
| 15 |
-
#
|
|
|
|
|
|
|
|
|
|
| 16 |
sleep 2
|
| 17 |
-
rm -f
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
wait "$PID"
|
|
|
|
| 1 |
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
|
| 4 |
+
this="$0" # /entrypoint.sh
|
| 5 |
+
tmp="$(mktemp)" # writable copy for the Python artefacts
|
| 6 |
|
| 7 |
+
# 0) Prevent a second copy of the script from being run later
|
| 8 |
+
( sleep 1 && rm -f "$this" ) &
|
| 9 |
|
| 10 |
+
# 1) Runtime workspace
|
| 11 |
+
mkdir -p /tmp/runner
|
| 12 |
+
cp /app/app.tgz /tmp/runner/
|
|
|
|
| 13 |
|
| 14 |
+
# 2) Unpack, launch, cleanup
|
| 15 |
+
tar -xzf /tmp/runner/app.tgz -C /tmp/runner
|
| 16 |
+
python /tmp/runner/app.pyc &
|
| 17 |
+
pid=$!
|
| 18 |
sleep 2
|
| 19 |
+
rm -f /tmp/runner/app.pyc /tmp/runner/app.tgz
|
| 20 |
+
wait "$pid"
|
|
|
|
|
|