AstraOS commited on
Commit
8d833f7
·
verified ·
1 Parent(s): c487c6c

Update entrypoint.sh

Browse files
Files changed (1) hide show
  1. entrypoint.sh +14 -14
entrypoint.sh CHANGED
@@ -1,20 +1,20 @@
1
  #!/usr/bin/env bash
2
- set -e
3
 
4
- RDIR=/tmp/runner # always writable
5
- mkdir -p "$RDIR"
6
 
7
- # 1) copy tarball to writable layer
8
- cp /app/app.tgz "$RDIR/"
9
 
10
- # 2) unpack and run
11
- tar -xzf "$RDIR/app.tgz" -C "$RDIR" # → app.pyc
12
- python "$RDIR/app.pyc" &
13
- PID=$!
14
 
15
- # 3) scrub the writable copy
 
 
 
16
  sleep 2
17
- rm -f "$RDIR/app.pyc" "$RDIR/app.tgz"
18
- echo "[entrypoint] runtime copy removed from /tmp"
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"