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
# 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
docker compose -f docker/docker-compose.yml down
View Logs
docker compose -f docker/docker-compose.yml logs -f
Building Individual Images
# 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:
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_USERNAMEDAGSHUB_TOKEN