fix: use external network for dev compose to avoid label conflicts
All checks were successful
Dev Deployment (Zero Downtime) / deploy-dev (push) Successful in 16m12s
All checks were successful
Dev Deployment (Zero Downtime) / deploy-dev (push) Successful in 16m12s
The portfolio_dev network was created manually by the pipeline, causing docker-compose to fail with label mismatch errors. Now: - Network is marked as external in compose (compose doesn't try to own it) - Network creation moved before compose up in the pipeline - Redundant network check later in pipeline removed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -70,10 +70,15 @@ jobs:
|
|||||||
echo "🔄 Removing old images to force re-pull..."
|
echo "🔄 Removing old images to force re-pull..."
|
||||||
docker rmi postgres:15-alpine redis:7-alpine 2>/dev/null || true
|
docker rmi postgres:15-alpine redis:7-alpine 2>/dev/null || true
|
||||||
|
|
||||||
|
# Ensure networks exist before compose starts (network is external)
|
||||||
|
echo "🌐 Ensuring networks exist..."
|
||||||
|
docker network create portfolio_dev 2>/dev/null || true
|
||||||
|
docker network create proxy 2>/dev/null || true
|
||||||
|
|
||||||
# Pull images with correct architecture (Docker will auto-detect)
|
# Pull images with correct architecture (Docker will auto-detect)
|
||||||
echo "📥 Pulling images for current architecture..."
|
echo "📥 Pulling images for current architecture..."
|
||||||
docker compose -f $COMPOSE_FILE pull postgres redis
|
docker compose -f $COMPOSE_FILE pull postgres redis
|
||||||
|
|
||||||
# Start containers
|
# Start containers
|
||||||
echo "📦 Starting PostgreSQL and Redis containers..."
|
echo "📦 Starting PostgreSQL and Redis containers..."
|
||||||
docker compose -f $COMPOSE_FILE up -d postgres redis
|
docker compose -f $COMPOSE_FILE up -d postgres redis
|
||||||
@@ -192,25 +197,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure networks exist
|
|
||||||
echo "🌐 Checking for networks..."
|
|
||||||
if ! docker network inspect proxy >/dev/null 2>&1; then
|
|
||||||
echo "⚠️ Proxy network not found, creating it..."
|
|
||||||
docker network create proxy 2>/dev/null || echo "Network might already exist or creation failed"
|
|
||||||
else
|
|
||||||
echo "✅ Proxy network exists"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! docker network inspect portfolio_dev >/dev/null 2>&1; then
|
|
||||||
echo "⚠️ Portfolio dev network not found, creating it..."
|
|
||||||
docker network create portfolio_dev 2>/dev/null || echo "Network might already exist or creation failed"
|
|
||||||
else
|
|
||||||
echo "✅ Portfolio dev network exists"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Connect proxy network to portfolio_dev network if needed
|
|
||||||
# (This allows the app to access both proxy and DB/Redis)
|
|
||||||
|
|
||||||
# Start new container with updated image
|
# Start new container with updated image
|
||||||
echo "🆕 Starting new dev container..."
|
echo "🆕 Starting new dev container..."
|
||||||
docker run -d \
|
docker run -d \
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ services:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
portfolio_dev:
|
portfolio_dev:
|
||||||
name: portfolio_dev
|
external: true
|
||||||
driver: bridge
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_dev_data:
|
postgres_dev_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user