This repository was archived by the owner on Jun 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (126 loc) · 4.52 KB
/
Copy pathMakefile
File metadata and controls
151 lines (126 loc) · 4.52 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Vietnamese ID Card OCR Makefile
.PHONY: help install install-windows install-dev setup run-streamlit run-api test lint format clean docker-build docker-run deploy-k3d deploy-k8s start-monitoring stop-monitoring
# Default target
help:
@echo "Vietnamese ID Card OCR - Available commands:"
@echo ""
@echo "Setup and Installation:"
@echo " install Install package and dependencies"
@echo " install-windows Install package and dependencies for Windows"
@echo " install-dev Install package with development dependencies"
@echo " setup Setup environment and validate models"
@echo " setup-config Setup configuration files"
@echo ""
@echo "Running Applications:"
@echo " run-streamlit Run Streamlit web interface"
@echo " run-api Run FastAPI server"
@echo ""
@echo "Development:"
@echo " test Run tests"
@echo " lint Run linting checks"
@echo " format Format code with black and isort"
@echo " clean Clean build artifacts"
@echo ""
@echo "Docker:"
@echo " docker-build Build Docker image"
@echo " docker-run Run with Docker Compose"
@echo ""
@echo "Deployment:"
@echo " deploy-k3d Deploy to K3D cluster"
@echo " deploy-k8s Deploy to Kubernetes"
@echo ""
@echo "Monitoring:"
@echo " start-monitoring Start monitoring stack"
@echo " stop-monitoring Stop monitoring stack"
@echo ""
# Installation
install:
pip install -r requirements.txt
pip install -e .
install-windows:
pip install -r requirements_windows.txt
pip install -e .
install-dev:
pip install -r requirements.txt
pip install -e ".[dev,api,ui]"
setup:
@echo "Setting up Vietnamese ID Card OCR..."
@python -c "from src.config import Config; print('Validating setup...'); results = Config.validate_setup(); print('Model validation:', results)"
@echo "Setup complete!"
# Configuration setup
setup-config:
@echo "Setting up configuration files..."
@if not exist .env (echo # Vietnamese ID Card OCR Configuration > .env && echo MLFLOW_ENABLED=false >> .env && echo Created .env file with MLflow disabled. Please edit it with your settings.)
@if not exist logs mkdir logs
@if not exist data\uploads mkdir data\uploads
@if not exist data\outputs mkdir data\outputs
@echo "Configuration setup complete!"
# Running applications
run-streamlit:
streamlit run streamlit_app.py
run-api:
python api_app.py
# Development
test:
pytest tests/ -v --cov=src
lint:
flake8 src/ tests/
black --check src/ tests/
isort --check-only src/ tests/
format:
black src/ tests/
isort src/ tests/
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
# Docker
docker-build:
docker build -f deployment\docker\Dockerfile -t vnid-card-ocr .
docker-run:
docker-compose -f deployment\docker\docker-compose.yml up -d
docker-stop:
docker-compose -f deployment\docker\docker-compose.yml down
docker-logs:
docker-compose logs -f
# Deployment
deploy-k3d:
@echo "Deploying to K3D cluster..."
make -f deployment\k3d\Makefile.k3d all
deploy-k8s:
@echo "Deploying to Kubernetes..."
kubectl apply -f deployment\k8s\
undeploy-k8s:
@echo "Removing from Kubernetes..."
kubectl delete -f deployment\k8s\ --ignore-not-found=true
# Monitoring
start-monitoring:
@echo "Starting monitoring stack..."
docker-compose -f monitoring\docker-compose.monitoring.yml up -d
stop-monitoring:
@echo "Stopping monitoring stack..."
docker-compose -f monitoring\docker-compose.monitoring.yml down
# Project structure
show-structure:
@echo "Current project structure:"
@tree /F /A
# Validation
validate-structure:
@echo "Validating project structure..."
@if exist src\__init__.py (echo ✓ Source package structure OK) else (echo ✗ Missing src\__init__.py)
@if exist config\settings.py (echo ✓ Configuration system OK) else (echo ✗ Missing config\settings.py)
@if exist deployment\docker\Dockerfile (echo ✓ Docker configuration OK) else (echo ✗ Missing Docker configuration)
@if exist deployment\k8s\deployment.yaml (echo ✓ K8s configuration OK) else (echo ✗ Missing K8s configuration)
@echo "Structure validation complete!"
# Complete setup for new developers
first-time-setup: install-windows setup-config validate-structure
@echo ""
@echo "🎉 First-time setup complete!"
@echo ""
@echo "Next steps:"
@echo "1. Edit .env file with your API keys and settings"
@echo "2. Run 'make run-streamlit' for web interface"
@echo "3. Run 'make run-api' for REST API"
@echo "4. Check docs\PROJECT_STRUCTURE.md for more information"