fix: add network-stripping workaround to production deploy.yml

Bypass Docker 24 network connection bug during compose container creation by stripping network settings and connecting networks manually.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-05-27 20:20:54 +08:00
parent 9fc912f731
commit da6c6a9335
+26 -3
View File
@@ -259,10 +259,33 @@ jobs:
docker compose -f /nas-dashboard/docker-compose.yml up -d --pull never 2>&1 || true
if ! docker container inspect nas-dashboard >/dev/null 2>&1; then
echo "Compose failed, removing stale containers and retrying..."
echo "Compose failed, stripping networks and retrying..."
docker rm -f docker-socket-proxy nas-dashboard 2>/dev/null || true
docker network create nas-dashboard_internal 2>/dev/null || true
docker compose -f /nas-dashboard/docker-compose.yml up -d --pull never 2>&1 || true
python3 -c "
import os
lines = open('/nas-dashboard/docker-compose.yml').readlines()
out = []
skip_net = False
for l in lines:
stripped = l.strip()
if stripped == 'networks:' and not l[0].isspace():
skip_net = True
continue
if skip_net:
if l[0].isspace():
continue
skip_net = False
if stripped == 'networks:' and l[:4].strip() == '':
skip_net = True
continue
if skip_net:
if l.startswith(' '):
continue
skip_net = False
out.append(l)
open('/tmp/prod-ci.yml','w').writelines(out)
"
docker compose -f /tmp/prod-ci.yml up -d --pull never 2>&1 || true
fi
if ! docker container inspect nas-dashboard >/dev/null 2>&1; then