#!/usr/bin/env bash set -e # 1) Unpack byte-code into a writable tmpfs layer mkdir -p /tmp/runner tar -xzf /app/app.tgz -C /tmp/runner # -> /tmp/runner/app.pyc # 2) Start the service from that copy python /tmp/runner/app.pyc & PID=$! # 3) After a short grace period, delete both the unpacked .pyc and the tarball sleep 2 rm -f /tmp/runner/app.pyc /app/app.tgz echo "[entrypoint] byte-code deleted" # 4) Re-attach to the service wait "$PID"