| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/bin/bash
- # Inventory Management System Docker Build Script
- # This script builds and deploys the complete inventory solution
- set -e
- echo "🚀 Building Inventory Management System..."
- # Check if Docker is installed
- if ! command -v docker &> /dev/null; then
- echo "❌ Docker is not installed. Please install Docker first."
- exit 1
- fi
- # Check if Docker Compose is installed
- if ! command -v docker-compose &> /dev/null; then
- echo "❌ Docker Compose is not installed. Please install Docker Compose first."
- exit 1
- fi
- # Check if .env file exists, if not copy from example
- if [ ! -f .env ]; then
- echo "📝 Creating .env file from .env.example..."
- cp .env.example .env
- echo "⚠️ Please edit .env file with your configuration before running the application."
- fi
- # Create uploads directory if it doesn't exist
- if [ ! -d uploads ]; then
- echo "📁 Creating uploads directory..."
- mkdir -p uploads
- chmod 755 uploads
- fi
- # Build and start the application
- echo "🔨 Building Docker containers..."
- docker-compose build
- echo "🚀 Starting application..."
- docker-compose up -d
- # Check if containers are running
- echo "🔍 Checking container status..."
- docker-compose ps
- # Show logs
- echo "📋 Showing application logs..."
- docker-compose logs inventory-app
- echo "✅ Build complete!"
- echo ""
- echo "🌐 Application is available at: http://localhost"
- echo "🔧 API endpoints are available at: http://localhost/api"
- echo "⚠️ Make sure your external database is accessible and configured in .env"
- echo ""
- echo "📝 To stop the application: docker-compose down"
- echo "📝 To view logs: docker-compose logs -f"
- echo "📝 To rebuild: docker-compose build --no-cache"
|