#!/usr/bin/env bash set -e # 1) Unpack the code into a writable overlay (tmpfs) mkdir -p /tmp/runner tar -xzf /app/app.tgz -C /tmp/runner # gives /tmp/runner/app.pyc # 2) Run Python on that copy python /tmp/runner/app.pyc & PID=$! # 3) Wait a moment, then unlink the byte-code and the tarball itself sleep 2 rm -f /tmp/runner/app.pyc /app/app.tgz echo "[entrypoint] Code deleted" # 4) Reap the process wait $PID