# 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`