This project uses Docker Compose to run both the frontend and backend services together.
- Docker Desktop (Windows/Mac) or Docker Engine + Docker Compose (Linux)
- At least 4GB of available RAM
- At least 2GB of free disk space
- Clone the repository:
git clone <repository-url>
cd urina- Start all services:
docker-compose up -d-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- Full Application (with reverse proxy): http://localhost
-
Stop all services:
docker-compose downFor development with hot reload:
- Start development services:
docker-compose -f docker-compose.dev.yml up -d-
Access the application:
- Frontend (with hot reload): http://localhost:5173
- Backend API: http://localhost:8000
-
Stop development services:
docker-compose -f docker-compose.dev.yml down- Container:
urina-backend - Port: 8000
- Technology: FastAPI + Python
- Model: PyTorch neural network for urine analysis
- Health Check:
http://localhost:8000/health
- Container:
urina-frontend - Port: 3000 (production) / 5173 (development)
- Technology: React + TypeScript + Tailwind CSS
- Build Tool: Vite
- Container:
urina-proxy - Port: 80
- Technology: Nginx
- Purpose: Routes frontend and API requests through a single port
# Build and start all services
docker-compose up --build
# Start in background
docker-compose up -d
# Start specific service
docker-compose up backend# View logs from all services
docker-compose logs
# View logs from specific service
docker-compose logs backend
docker-compose logs frontend
# Follow logs in real-time
docker-compose logs -f# Stop all services
docker-compose down
# Stop and remove volumes
docker-compose down -v
# Restart specific service
docker-compose restart backend
# Rebuild specific service
docker-compose up --build backend# Remove all containers, networks, and images
docker-compose down --rmi all
# Remove unused Docker resources
docker system prune -fPORT=8000
HOST=0.0.0.0
DEBUG=False
MODEL_PATH=models/40_epochs.pth
CORS_ORIGINS=http://localhost:3000,http://localhost:5173,http://frontend:80NODE_ENV=production
VITE_API_URL=http://localhost:8000./backend/models:/app/models- Model files./backend/images:/app/images- Test images./frontend:/app- Frontend source (development only)
All services run on the urina-network bridge network, allowing inter-service communication.
-
Port conflicts:
- Make sure ports 80, 3000, 5173, and 8000 are not in use
- Modify ports in docker-compose.yml if needed
-
Memory issues:
- Ensure Docker has enough memory allocated (4GB recommended)
- Check Docker Desktop settings
-
Build failures:
- Clear Docker cache:
docker system prune -f - Rebuild from scratch:
docker-compose build --no-cache
- Clear Docker cache:
-
Model file missing:
- Ensure
40_epochs.pthis in thebackend/models/directory - Check file permissions
- Ensure
All services include health checks:
# Check service health
docker-compose ps
# Manual health check
curl http://localhost:8000/health # Backend
curl http://localhost:3000 # Frontend- Access container shell:
# Backend container
docker-compose exec backend bash
# Frontend container
docker-compose exec frontend sh- View detailed logs:
# All services
docker-compose logs --details
# Specific service with timestamps
docker-compose logs -t backend- Start development environment:
docker-compose -f docker-compose.dev.yml up -d-
Make changes to source code (auto-reload enabled)
-
View logs for debugging:
docker-compose -f docker-compose.dev.yml logs -f-
Test the application at http://localhost:5173
-
Stop when done:
docker-compose -f docker-compose.dev.yml downFor production deployment:
- Update environment variables in
.envfiles - Build production images:
docker-compose build- Start services:
docker-compose up -d- Monitor with logs:
docker-compose logs -f- Change default ports in production
- Use environment-specific
.envfiles - Enable HTTPS with SSL certificates
- Implement proper authentication
- Regular security updates for base images
- Use multi-stage builds for smaller images
- Implement proper caching strategies
- Monitor resource usage
- Scale services as needed
# Backup volumes
docker run --rm -v urina_models_data:/data -v $(pwd):/backup alpine tar czf /backup/models_backup.tar.gz /data
# Restore volumes
docker run --rm -v urina_models_data:/data -v $(pwd):/backup alpine tar xzf /backup/models_backup.tar.gz -C /