Spaces:
Runtime error
Runtime error
| # Docker build script for Bank Statement Analyzer | |
| echo "π³ Building Bank Statement Analyzer Docker Image" | |
| echo "==================================================" | |
| # Check if we're in the right directory | |
| if [ ! -f "Dockerfile" ]; then | |
| echo "β Error: Dockerfile not found in current directory" | |
| echo " Please run this script from the project root directory" | |
| exit 1 | |
| fi | |
| # Check build context size | |
| echo "π Checking build context size..." | |
| python3 check-build-context.py | |
| echo "" | |
| echo "π¦ Building Docker image..." | |
| # Check if pyproject.toml exists | |
| if [ ! -f "pyproject.toml" ]; then | |
| echo "β Error: pyproject.toml not found!" | |
| echo " Please ensure you have a valid pyproject.toml file" | |
| exit 1 | |
| fi | |
| # Try building with the main Dockerfile first | |
| echo "π Attempting build with main Dockerfile..." | |
| docker build -t bank-statement-analyzer . | |
| if [ $? -eq 0 ]; then | |
| echo "" | |
| echo "β Docker image built successfully!" | |
| echo "" | |
| echo "π To run the application:" | |
| echo " docker run -p 8501:8501 --env-file .env bank-statement-analyzer" | |
| echo "" | |
| echo " Or use docker-compose:" | |
| echo " docker-compose up" | |
| else | |
| echo "" | |
| echo "β οΈ Main Dockerfile build failed. Trying alternative method..." | |
| # Check if alternative Dockerfile exists | |
| if [ -f "Dockerfile.alternative" ]; then | |
| echo "π Attempting build with alternative Dockerfile..." | |
| docker build -f Dockerfile.alternative -t bank-statement-analyzer . | |
| if [ $? -eq 0 ]; then | |
| echo "" | |
| echo "β Docker image built successfully with alternative method!" | |
| echo "" | |
| echo "π To run the application:" | |
| echo " docker run -p 8501:8501 --env-file .env bank-statement-analyzer" | |
| echo "" | |
| echo " Or use docker-compose:" | |
| echo " docker-compose up" | |
| else | |
| echo "" | |
| echo "β οΈ Alternative Dockerfile also failed. Trying fallback method..." | |
| # Check if fallback Dockerfile exists | |
| if [ -f "Dockerfile.fallback" ]; then | |
| echo "π Attempting build with fallback Dockerfile (pip-based)..." | |
| docker build -f Dockerfile.fallback -t bank-statement-analyzer . | |
| if [ $? -eq 0 ]; then | |
| echo "" | |
| echo "β Docker image built successfully with fallback method!" | |
| echo "" | |
| echo "π To run the application:" | |
| echo " docker run -p 8501:8501 --env-file .env bank-statement-analyzer" | |
| echo "" | |
| echo " Or use docker-compose:" | |
| echo " docker-compose up" | |
| else | |
| echo "" | |
| echo "β All Dockerfile methods failed!" | |
| echo "" | |
| echo "π‘ Troubleshooting tips:" | |
| echo " - Check if Poetry is properly configured" | |
| echo " - Ensure pyproject.toml and poetry.lock are valid" | |
| echo " - Try running 'poetry install' locally first" | |
| echo " - Check Docker logs for specific error messages" | |
| echo " - Verify system dependencies are available" | |
| echo "" | |
| echo "π§ Manual troubleshooting:" | |
| echo " docker build -t bank-statement-analyzer . 2>&1 | tee build.log" | |
| exit 1 | |
| fi | |
| else | |
| echo "" | |
| echo "β Fallback Dockerfile not found!" | |
| echo "" | |
| echo "π‘ Troubleshooting tips:" | |
| echo " - Check if large files are being included in build context" | |
| echo " - Ensure .dockerignore is properly configured" | |
| echo " - Try running 'python3 check-build-context.py' to identify issues" | |
| echo " - Check Poetry installation and configuration" | |
| exit 1 | |
| fi | |
| fi | |
| else | |
| echo "" | |
| echo "β Alternative Dockerfile not found!" | |
| echo "" | |
| echo "π‘ Troubleshooting tips:" | |
| echo " - Check if large files are being included in build context" | |
| echo " - Ensure .dockerignore is properly configured" | |
| echo " - Try running 'python3 check-build-context.py' to identify issues" | |
| echo " - Check Poetry installation and configuration" | |
| exit 1 | |
| fi | |
| fi |