Curling the sibling container's own bridge-network IP (the previous fix) doesn't work on this runner -- docker-outside-of-docker means the job container's network namespace can't reach another container's bridge IP directly, so every curl attempt hung for the full ~130s TCP SYN timeout instead of failing fast (confirmed: a run got stuck for over 10 minutes on this). 127.0.0.1 does work here (the monorepo's own build.yml has published a host port successfully all along), so publish one again, but to a per-run PID-derived port instead of a fixed one, to still avoid the original port-collision problem.
57 lines
2.3 KiB
YAML
57 lines
2.3 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
|
|
# Curling the sibling container's own bridge IP does NOT work on
|
|
# this runner (docker-outside-of-docker: the job container's network
|
|
# namespace can't reach another container's bridge IP directly --
|
|
# every attempt hangs for the full TCP SYN timeout, ~130s, instead of
|
|
# failing fast) -- confirmed by a stuck run. 127.0.0.1 DOES work
|
|
# (proven by the monorepo's own build.yml, which has used a
|
|
# published host port successfully all along), so publish one, but
|
|
# to a per-run PID-derived port rather than a fixed one -- this
|
|
# runner's snap-Docker install has a known AppArmor bug denying
|
|
# docker stop/kill, so a leftover container from any prior failed
|
|
# run permanently squats whatever host port it was given, and a
|
|
# fixed port would block every subsequent run too.
|
|
run: |
|
|
name="backend-ci-$$"
|
|
port=$((18000 + ($$ % 1000)))
|
|
docker run -d --name "$name" \
|
|
-e THERMOGRAPH_FRONTEND_BASE_INTERNAL=http://127.0.0.1:1 \
|
|
-p "127.0.0.1:${port}:8137" thermograph-backend:ci
|
|
ok=0
|
|
for i in $(seq 1 30); do
|
|
if curl -fsS -o /dev/null "http://127.0.0.1:${port}/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"
|