#!/usr/bin/env bash # Check that this machine can build and run the scaffold. The host needs only Docker # (with Compose v2 and BuildKit) and git; Python runs inside the container. # Exits non-zero if something required is missing. Installs nothing. ok=1 pass() { printf ' ok %s\n' "$*"; } fail() { printf ' MISS %s\n' "$*"; ok=0; } note() { printf ' note %s\n' "$*"; } echo "Host tools" if command -v git >/dev/null; then pass "git $(git --version | awk '{print $3}')"; else fail "git: install it (e.g. sudo apt install git)"; fi if command -v docker >/dev/null; then pass "docker $(docker --version | sed 's/Docker version //; s/,.*//')"; else fail "docker: install Docker Engine (https://docs.docker.com/engine/install/)"; fi if command -v docker >/dev/null; then if docker compose version >/dev/null 2>&1; then pass "compose $(docker compose version --short)"; else fail "docker compose v2 plugin: sudo apt install docker-compose-plugin"; fi if docker buildx version >/dev/null 2>&1; then pass "buildx (BuildKit; needed for COPY --chmod)"; else fail "docker buildx plugin: sudo apt install docker-buildx-plugin"; fi if docker info >/dev/null 2>&1; then pass "daemon reachable as $(id -un)"; else fail "cannot talk to the Docker daemon: start it, or add yourself to the docker group (sudo usermod -aG docker $USER, then log in again)"; fi fi echo "Notes" note "host uid $(id -u): the image's app user defaults to uid 1000; dev bind mounts are easiest when they match" command -v python3 >/dev/null && note "host python3 $(python3 -V 2>&1 | awk '{print $2}') is not used; Python runs in the container" [ "$ok" = 1 ] && { echo "Ready."; exit 0; } echo "Fix the MISS lines above, then re-run." exit 1