File size: 1,503 Bytes
6bbbfda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# 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"