This runner's snap-Docker install has a known AppArmor bug denying docker stop/kill -- a leftover container from any failed run would permanently squat host port 8137, so every SUBSEQUENT run's docker run also failed immediately (port already allocated), compounding into a cascading failure loop. Uses a unique-per-run container name and curls the container's own bridge-network IP directly instead of publishing any host port at all.
51 lines
1.9 KiB
YAML
51 lines
1.9 KiB
YAML
name: Build + boot check
|
|
|
|
# Proves the split Dockerfile actually builds and boots standalone (repo-split
|
|
# Stage 7b) -- not yet a full pytest-suite migration (that's separate, real
|
|
# follow-up work, same category as thermograph-copy's deferred vendoring).
|
|
# THERMOGRAPH_FRONTEND_BASE_INTERNAL is required (fails loud if unset) but
|
|
# never actually exercised here -- /healthz doesn't go through the
|
|
# catch-all proxy, so an unreachable placeholder is fine for this check.
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: docker
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Docker CLI
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -y -qq docker.io
|
|
|
|
- name: Build
|
|
run: docker build -t thermograph-backend:ci .
|
|
|
|
- name: Boot + health check
|
|
# No -p host-port publish and a unique-per-run container name (this
|
|
# runner's snap-Docker install has a known AppArmor bug denying
|
|
# docker stop/kill -- a leftover container from a prior failed run
|
|
# would otherwise permanently squat a fixed host port and block
|
|
# every subsequent run too). Curl the container's own bridge-network
|
|
# IP directly instead.
|
|
run: |
|
|
name="backend-ci-$$"
|
|
docker run -d --name "$name" \
|
|
-e THERMOGRAPH_FRONTEND_BASE_INTERNAL=http://127.0.0.1:1 \
|
|
thermograph-backend:ci
|
|
ip=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$name")
|
|
ok=0
|
|
for i in $(seq 1 30); do
|
|
if curl -fsS -o /dev/null "http://${ip}:8137/healthz"; then ok=1; break; fi
|
|
sleep 1
|
|
done
|
|
docker logs "$name"
|
|
docker rm -f "$name" >/dev/null 2>&1 || true
|
|
if [ "$ok" != 1 ]; then echo "backend never became healthy"; exit 1; fi
|
|
echo "OK: backend booted standalone"
|