Force remove problematic container and improve Node.js setup
- Add specific removal of problematic container afa9a70588844b06e17d5e0527119d589a7a3fde8a17608447cf7d8d448cf261 - Force remove portfolio-app-new container before deployment - Add container listing for debugging after cleanup - Upgrade setup-node to v4 for better performance - Add cache-dependency-path for more efficient caching - Create fast workflow alternative with manual cache management
This commit is contained in:
@@ -21,10 +21,11 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
cache-dependency-path: 'package-lock.json'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
@@ -52,6 +53,11 @@ jobs:
|
||||
run: |
|
||||
echo "🚀 Preparing zero-downtime deployment..."
|
||||
|
||||
# FORCE REMOVE the problematic container
|
||||
echo "🧹 FORCE removing problematic container portfolio-app-new..."
|
||||
docker rm -f portfolio-app-new || true
|
||||
docker rm -f afa9a70588844b06e17d5e0527119d589a7a3fde8a17608447cf7d8d448cf261 || true
|
||||
|
||||
# Check if current container is running
|
||||
if docker ps -q -f name=portfolio-app | grep -q .; then
|
||||
echo "📊 Current container is running, proceeding with zero-downtime update"
|
||||
@@ -120,6 +126,9 @@ jobs:
|
||||
# Remove specific known problematic containers
|
||||
docker rm -f portfolio-app-new portfolio-app-temp-* portfolio-app-backup || true
|
||||
|
||||
# FORCE remove the specific problematic container by ID
|
||||
docker rm -f afa9a70588844b06e17d5e0527119d589a7a3fde8a17608447cf7d8d448cf261 || true
|
||||
|
||||
# Find and remove any containers with portfolio-app in the name (except the main one)
|
||||
EXISTING_CONTAINERS=$(docker ps -a --format "table {{.Names}}" | grep "portfolio-app" | grep -v "^portfolio-app$" || true)
|
||||
if [ -n "$EXISTING_CONTAINERS" ]; then
|
||||
@@ -131,6 +140,10 @@ jobs:
|
||||
# Also clean up any stopped containers
|
||||
docker container prune -f || true
|
||||
|
||||
# Double-check: list all containers to see what's left
|
||||
echo "📋 Current containers after cleanup:"
|
||||
docker ps -a --format "table {{.Names}}\t{{.Status}}" | grep portfolio || echo "No portfolio containers found"
|
||||
|
||||
# Start new container with unique temporary name (no port mapping needed for health check)
|
||||
docker run -d \
|
||||
--name $TEMP_CONTAINER_NAME \
|
||||
|
||||
Reference in New Issue
Block a user