File size: 2,716 Bytes
7af74d7 |
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 |
# Docker Configuration
This directory contains all Docker-related configuration files for the Hopcroft Skill Classification project.
## Directory Structure
```
docker/
βββ Dockerfile # Main API container (Python 3.10, FastAPI, Nginx)
βββ Dockerfile.streamlit # Streamlit GUI container
βββ docker-compose.yml # Multi-service orchestration
βββ nginx.conf # Reverse proxy configuration for HF Spaces
βββ .dockerignore # Build context exclusions
βββ scripts/
β βββ start_space.sh # Startup script for Hugging Face Spaces
βββ README.md # This file
```
## File Descriptions
| File | Purpose |
|------|---------|
| `Dockerfile` | Main container with FastAPI API, DVC, Nginx. Used for HF Spaces deployment. |
| `Dockerfile.streamlit` | Lightweight Streamlit-only container for GUI service. |
| `docker-compose.yml` | Orchestrates API, GUI, Prometheus, Grafana, Alertmanager, Pushgateway. |
| `nginx.conf` | Reverse proxy routing traffic to API (8000) and Streamlit (8501) on port 7860. |
| `.dockerignore` | Excludes data/, tests/, docs/ etc. from Docker build context. |
| `start_space.sh` | Configures DVC, pulls models, starts FastAPI + Streamlit + Nginx. |
## Quick Start
### Local Development
```bash
# From the docker/ directory
docker compose up -d --build
# Or from repository root
docker compose -f docker/docker-compose.yml up -d --build
```
**Available Services:**
| Service | URL |
|---------|-----|
| API (FastAPI) | http://localhost:8080/docs |
| GUI (Streamlit) | http://localhost:8501 |
| Prometheus | http://localhost:9090 |
| Grafana | http://localhost:3000 (admin/admin) |
| Pushgateway | http://localhost:9091 |
| Alertmanager | http://localhost:9093 |
### Stop Services
```bash
docker compose -f docker/docker-compose.yml down
```
### View Logs
```bash
docker compose -f docker/docker-compose.yml logs -f
```
## Building Individual Images
```bash
# From repository root
docker build -f docker/Dockerfile -t hopcroft-api:latest .
docker build -f docker/Dockerfile.streamlit -t hopcroft-gui:latest .
```
## Environment Variables
The `.env` file in the repository root is automatically loaded. Required variables:
```env
MLFLOW_TRACKING_URI=https://dagshub.com/se4ai2526-uniba/Hopcroft.mlflow
MLFLOW_TRACKING_USERNAME=your_username
MLFLOW_TRACKING_PASSWORD=your_token
```
## Hugging Face Spaces
The `Dockerfile` and `start_space.sh` are configured for HF Spaces deployment:
- Exposes port 7860 (HF Spaces requirement)
- Uses Nginx as reverse proxy
- Pulls models from DagsHub via DVC on startup
**Secrets required on HF Spaces:**
- `DAGSHUB_USERNAME`
- `DAGSHUB_TOKEN`
|