Files
kidsai/docker-dev.sh
mindesbunister b31492a354 Complete Docker migration with Next.js 15 and cleaned design
- Migrated from Express.js to Next.js 15 with TypeScript
- Added Docker Compose v2 with multi-stage builds
- Implemented Docker Bake support for improved builds
- Created professional component structure with Tailwind CSS
- Added enhanced visual design with glass morphism effects
- Improved responsive layout and better UX flow
- Updated all dependencies and configurations
- Added proper TypeScript types and modern practices
- Created development scripts for easy container management
- Cleaned up excessive animations for better user experience
2025-07-14 10:11:06 +02:00

113 lines
3.6 KiB
Bash
Executable File

#!/bin/bash
# KidsAI Explorer - Docker Development Setup Script
# This script sets up the development environment with optional Docker Bake support
set -e
echo "🚀 KidsAI Explorer - Docker Setup"
echo "=================================="
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker first."
exit 1
fi
# Check if docker-compose is available
if ! command -v docker-compose &> /dev/null; then
echo "❌ docker-compose is not installed. Please install Docker Compose v2."
exit 1
fi
# Create .env file if it doesn't exist
if [ ! -f .env ]; then
echo "📝 Creating .env file from template..."
cp .env.example .env
echo "⚠️ Please edit .env file and add your API keys before running the application."
fi
# Check if Docker Buildx is available for Bake support
if docker buildx version &> /dev/null 2>&1; then
export COMPOSE_BAKE=true
echo "✅ Docker Bake support enabled (Docker Buildx available)"
else
echo "⚠️ Docker Buildx not available - using standard builds"
echo " For better build performance, consider upgrading to Docker Desktop or installing buildx"
fi
# Function to show available commands
show_help() {
echo ""
echo "Available commands:"
echo " dev - Start development environment"
echo " prod - Start production environment"
echo " build - Build images (with Bake if available)"
echo " build-dev - Build development image"
echo " build-prod - Build production image"
echo " stop - Stop all services"
echo " clean - Clean up containers and images"
echo " logs - Show application logs"
echo " shell - Open shell in running container"
echo " help - Show this help"
}
# Parse command line arguments
case "${1:-help}" in
"dev")
echo "🔧 Starting development environment..."
docker-compose up --build
;;
"prod")
echo "🚀 Starting production environment..."
docker-compose --profile production up --build app-prod
;;
"build")
if docker buildx version &> /dev/null 2>&1; then
echo "🏗️ Building all images with Docker Bake..."
docker buildx bake --load
else
echo "🏗️ Building images with standard Docker build..."
docker-compose build
fi
;;
"build-dev")
if docker buildx version &> /dev/null 2>&1; then
echo "🏗️ Building development image with Docker Bake..."
docker buildx bake development --load
else
echo "🏗️ Building development image..."
docker-compose build app
fi
;;
"build-prod")
if docker buildx version &> /dev/null 2>&1; then
echo "🏗️ Building production image with Docker Bake..."
docker buildx bake production --load
else
echo "🏗️ Building production image..."
docker-compose build app-prod
fi
;;
"stop")
echo "🛑 Stopping all services..."
docker-compose down
;;
"clean")
echo "🧹 Cleaning up containers and images..."
docker-compose down --rmi all --volumes --remove-orphans
docker system prune -f
;;
"logs")
echo "📋 Showing application logs..."
docker-compose logs -f app
;;
"shell")
echo "🐚 Opening shell in running container..."
docker-compose exec app sh
;;
"help"|*)
show_help
;;
esac