Spaces:
Sleeping
Sleeping
| # Deployment script for Marine Pollution Detection API | |
| # This script cleans up unnecessary files and prepares for deployment | |
| echo "Starting deployment preparation..." | |
| # 1. Remove all test files | |
| echo "Removing test files..." | |
| find . -name "test_*.py" -type f -delete | |
| rm -rf test_files/ test_output/ tests/ | |
| # 2. Remove unnecessary Python files | |
| echo "Removing unnecessary Python files..." | |
| rm -f debug_cloudinary.py create_test_user.py generate_test_incidents.py list_incidents.py train_models.py | |
| # 3. Remove smaller YOLOv8 models (we only need YOLOv8x) | |
| echo "Removing smaller YOLO models..." | |
| rm -f yolov8n.pt yolov8s.pt yolov8m.pt yolov8l.pt | |
| # Note: Keep yolov8x.pt as it's required | |
| # 4. Use production Dockerfile and .dockerignore | |
| echo "Setting up production Docker files..." | |
| cp Dockerfile.prod Dockerfile | |
| cp .dockerignore.prod .dockerignore | |
| # 5. Clean up Python cache files | |
| echo "Cleaning up Python cache files..." | |
| find . -name "__pycache__" -type d -exec rm -rf {} + | |
| find . -name "*.pyc" -type f -delete | |
| find . -name "*.pyo" -type f -delete | |
| find . -name "*.pyd" -type f -delete | |
| find . -name ".pytest_cache" -type d -exec rm -rf {} + | |
| # 6. Keep only necessary requirements | |
| echo "Setting up production requirements..." | |
| cp requirements.txt requirements.bak | |
| # Use specific requirements file for deployment | |
| cp requirements-docker.txt requirements.txt | |
| echo "Deployment preparation completed successfully!" | |
| echo "Use 'docker build -t marine-pollution-api .' to build the production container" |