fix(scripts): update launcher to support podman with modern compose syntax

Updated container execution path to:
- Detect and prefer podman over docker (modern container runtime)
- Use modern 'docker compose' and 'podman compose' syntax (without hyphen)
- Properly handle both podman and docker as fallback options
- Display which container runtime is being used in output

Key improvements:
- Container runtime detection (prefer podman, fallback to docker)
- Uses 'podman compose' or 'docker compose' based on available runtime
- Updated status messages to show container runtime information
- Renamed internal references from Docker-specific to generic "container"

Testing results:
 Podman is properly detected and used (podman compose works)
 Container image building with podman compose --no-cache succeeds
 Native execution path unchanged and still fully functional
 Both execution modes work correctly with proper pre-flight checks

The launcher now correctly uses:
- Modern compose syntax: 'podman compose' (not 'podman-compose')
- Proper container runtime auto-detection with podman preference
- Fallback to docker if podman not available

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Krypto Kajun
2025-11-17 20:45:58 -06:00
parent 566f3f03ca
commit 687350b285

View File

@@ -119,42 +119,47 @@ echo "║ ║
echo "╚════════════════════════════════════════════════════════════════════╝"
echo ""
# Handle Docker execution path
# Handle container execution path (supports both Docker and Podman)
if [ "$USE_DOCKER" = true ]; then
echo -e "${BLUE}[1/3] Checking Docker and docker-compose...${NC}"
# Detect container runtime (prefer podman, fallback to docker)
CONTAINER_RUNTIME=""
COMPOSE_CMD=""
if ! command -v docker &> /dev/null; then
echo -e "${RED}❌ Docker not found. Install Docker to use --docker flag${NC}"
if command -v podman &> /dev/null; then
CONTAINER_RUNTIME="podman"
COMPOSE_CMD="podman compose"
elif command -v docker &> /dev/null; then
CONTAINER_RUNTIME="docker"
COMPOSE_CMD="docker compose"
else
echo -e "${RED}❌ Neither podman nor docker found. Install one to use --docker flag${NC}"
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo -e "${RED}❌ docker-compose not found. Install docker-compose to use --docker flag${NC}"
exit 1
fi
echo -e "${GREEN}✅ Docker and docker-compose available${NC}"
echo -e "${BLUE}[1/3] Checking container runtime: $CONTAINER_RUNTIME...${NC}"
echo -e "${GREEN}✅ Container runtime available: $CONTAINER_RUNTIME${NC}"
echo ""
# Setup environment file for Docker
echo -e "${BLUE}[2/3] Setting up Docker environment...${NC}"
# Setup environment file for container
echo -e "${BLUE}[2/3] Setting up container environment...${NC}"
cat > "$PROJECT_ROOT/.env.docker" << EOF
ARBITRUM_RPC_ENDPOINT=$RPC_URL
LOG_LEVEL=debug
EOF
echo -e "${GREEN}Docker environment configured${NC}"
echo -e "${GREEN}Container environment configured${NC}"
echo ""
# Build and run with docker-compose
echo -e "${BLUE}[3/3] Building Docker image and starting container...${NC}"
# Build and run with compose
echo -e "${BLUE}[3/3] Building container image and starting container...${NC}"
cd "$PROJECT_ROOT"
echo "Building Docker image..."
docker-compose build --no-cache
echo "Building container image with $COMPOSE_CMD..."
$COMPOSE_CMD build --no-cache
if [ $? -eq 0 ]; then
echo -e "${GREEN}Docker image built successfully${NC}"
echo -e "${GREEN}Container image built successfully${NC}"
else
echo -e "${RED}Docker build failed${NC}"
echo -e "${RED}Container build failed${NC}"
exit 1
fi
echo ""
@@ -163,24 +168,25 @@ EOF
echo ""
echo "╔════════════════════════════════════════════════════════════════════╗"
echo "║ 🐳 STARTING FLASH SWAP BOT IN DOCKER CONTAINER ║"
echo "║ 🐳 STARTING FLASH SWAP BOT IN CONTAINER ║"
echo "╠════════════════════════════════════════════════════════════════════╣"
echo "║ ║"
echo "║ Container Name: mev-bot-production ║"
echo "║ RPC Endpoint: $RPC_URL"
echo "║ Status: Starting... ║"
echo "║ Container Runtime: $CONTAINER_RUNTIME "
echo "║ Container Name: mev-bot-production ║"
echo "║ RPC Endpoint: $RPC_URL"
echo "║ Status: Starting... ║"
echo "║ ║"
echo "║ Press Ctrl+C to stop container gracefully ║"
echo "║ ║"
echo "╚════════════════════════════════════════════════════════════════════╝"
echo ""
# Start services with docker-compose
docker-compose up
# Start services with compose
$COMPOSE_CMD up
# Cleanup on exit
echo -e "${YELLOW}Stopping Docker container...${NC}"
docker-compose down
echo -e "${YELLOW}Stopping container...${NC}"
$COMPOSE_CMD down
echo -e "${GREEN}✅ Container stopped gracefully${NC}"
exit 0