#!/bin/bash # TeleBot Build Script # This script builds TeleBot Docker image with the correct Dockerfile set -e echo "================================================" echo "🤖 Building TeleBot Docker Image" echo "================================================" echo "" # Colors for output GREEN='\033[0;32m' YELLOW='\033[1;33m' RED='\033[0;31m' NC='\033[0m' # No Color # Navigate to project root cd "$(dirname "$0")" echo -e "${YELLOW}Step 1: Building TeleBot image...${NC}" docker build -t telebot:latest -f Dockerfile.telebot . || { echo -e "${RED}Error: Failed to build TeleBot${NC}" echo "Make sure you're running this from /opt/LittleShop or /opt/littleshop" exit 1 } echo -e "${GREEN}✓ TeleBot built successfully${NC}" echo "" echo -e "${YELLOW}Step 2: Tagging for registry...${NC}" docker tag telebot:latest localhost:5000/telebot:latest echo -e "${GREEN}✓ Tagged as localhost:5000/telebot:latest${NC}" echo "" echo -e "${YELLOW}Step 3: Pushing to registry...${NC}" docker push localhost:5000/telebot:latest || { echo -e "${YELLOW}⚠ Failed to push to registry (registry might be down)${NC}" echo "You can still use the local image" } echo "" echo -e "${YELLOW}Step 4: Restarting TeleBot container...${NC}" if [ -f "docker-compose.telebot.yml" ]; then docker-compose -f docker-compose.telebot.yml down docker-compose -f docker-compose.telebot.yml up -d echo -e "${GREEN}✓ TeleBot restarted with new image${NC}" else docker restart telebot || echo -e "${YELLOW}⚠ Container restart failed, may need manual intervention${NC}" fi echo "" echo "================================================" echo -e "${GREEN}✅ TeleBot Build Complete!${NC}" echo "================================================" echo "" echo "To check status:" echo " docker ps | grep telebot" echo " docker logs --tail 50 telebot" echo "" echo "Note: This script uses Dockerfile.telebot which avoids path issues"