#!/usr/bin/env bash # Runs once, when the container is created. Executes each repo's setup command # from stack.conf. set -euo pipefail here="$(cd "$(dirname "$0")/.." && pwd)" source "$here/stack.conf" # The workspace root, which holds every repo of the stack as a sibling. cd "$here/.." for service in "${SERVICES[@]}"; do IFS='|' read -r dir setup run <<<"$service" [ -n "$setup" ] || continue echo "==> $dir: $setup" (cd "$dir" && exec bash -c "$setup") done # Anything else the stack needs once: writing a dev config file one of the # repos expects, creating state directories, seeding a database. There is no # TTY here, so nothing may prompt. # # echo "==> my-frontend/public/env.js" # cat > my-frontend/public/env.js <<'JS' # window.env = { # SERVER_URL: 'http://localhost:4747' # } # JS