ci: use custom bridge network to avoid port conflicts and get reliable container IP
CI Pipeline / HTML Lint (push) Successful in 7s
Deploy QA / Build and Push (push) Successful in 13s
CI Pipeline / Build Docker Image (push) Failing after 28m28s
CI Pipeline / Security Scan (push) Has been skipped
Deploy QA / Deploy to QA (push) Failing after 2s
CI Pipeline / Generate Summary (push) Failing after 1s
Deploy QA / Notification (push) Failing after 1s

This commit is contained in:
2026-06-01 20:43:11 -06:00
parent e077fdec07
commit d53398ca0c
+6 -3
View File
@@ -67,10 +67,11 @@ jobs:
- name: Verify image starts - name: Verify image starts
run: | run: |
set -euo pipefail set -euo pipefail
docker network create ci-test-net 2>/dev/null || true
docker stop ci-test || true docker stop ci-test || true
docker rm ci-test || true docker rm ci-test || true
docker run -d --name ci-test \ docker run -d --name ci-test \
-p 0:80 \ --network ci-test-net \
-e APP_ENV=ci \ -e APP_ENV=ci \
-e APP_VERSION=ci-${{ gitea.sha }} \ -e APP_VERSION=ci-${{ gitea.sha }} \
-e BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ -e BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
@@ -78,13 +79,14 @@ jobs:
-e GIT_BRANCH=${{ gitea.ref_name }} \ -e GIT_BRANCH=${{ gitea.ref_name }} \
-e DEPLOY_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \ -e DEPLOY_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
ci-image:latest ci-image:latest
CI_PORT=$(docker port ci-test 80 | cut -d: -f2) CI_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ci-test)
for i in $(seq 1 12); do for i in $(seq 1 12); do
if curl -sf http://localhost:$CI_PORT/health > /dev/null 2>&1; then if curl -sf http://$CI_IP/health > /dev/null 2>&1; then
echo "::notice::Health check passed" echo "::notice::Health check passed"
docker logs ci-test 2>&1 || true docker logs ci-test 2>&1 || true
docker stop ci-test docker stop ci-test
docker rm ci-test docker rm ci-test
docker network rm ci-test-net
exit 0 exit 0
fi fi
sleep 5 sleep 5
@@ -93,6 +95,7 @@ jobs:
docker logs ci-test 2>&1 || true docker logs ci-test 2>&1 || true
docker stop ci-test docker stop ci-test
docker rm ci-test docker rm ci-test
docker network rm ci-test-net
exit 1 exit 1
- name: Move cache - name: Move cache