From 135dd3143c9e7676b116132305febbbfd934928a Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sat, 28 Nov 2026 11:57:37 +0100 Subject: [PATCH] ci: run the image smoke test in the job network The job container cannot reach a port published on the Docker host loopback. Start the app in the job's network namespace and check it on localhost. --- .gitea/workflows/ci.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 020bf14..6cf02fa 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -136,8 +136,22 @@ jobs: run: | docker rm -f rhema-together-ci || true trap 'docker rm -f rhema-together-ci || true' EXIT - docker run -d --name rhema-together-ci \ - -p 127.0.0.1:18000:7800 rhema-together:ci + + # The job runs in a container with the host Docker socket. A + # published port binds the host loopback, which the job cannot + # reach. Run the app in the job's network namespace instead. + job_container="$(hostname)" + if ! docker inspect "$job_container" >/dev/null 2>&1; then + job_container="$(docker ps --filter 'name=GITEA-ACTIONS-TASK' --format '{{.ID}}' | head -n1)" + fi + if [ -n "$job_container" ] && [ "$(docker inspect -f '{{.HostConfig.NetworkMode}}' "$job_container")" != "host" ]; then + network="container:${job_container}" + else + network="host" + fi + + docker run -d --name rhema-together-ci --network "$network" \ + -e TOGETHER_LISTEN=127.0.0.1:18000 rhema-together:ci ok=0 for i in $(seq 1 30); do if curl -fsS http://127.0.0.1:18000/api/bootstrap > /tmp/bootstrap.json; then