# Dockerfile.sustainability

## Purpose

This Dockerfile is specifically designed for building the sustainability gradio apps deployment. It is nearly identical to the main `Dockerfile`, with one key difference: it uses WiDS (Women in Data Science) prediction cache files instead of the standard prediction cache files.

## Key Differences from Main Dockerfile

### Cache File Names
- **Main Dockerfile**: Uses `prediction_cache.json.gz` and `prediction_cache_full_models.json.gz`
- **Sustainability Dockerfile**: Uses `wids_prediction_cache.json.gz` and `wids_prediction_cache_full_models.json.gz`

### Conversion Script
- **Main Dockerfile**: Uses `convert_db.py`
- **Sustainability Dockerfile**: Uses `convert_db_wids.py` (which expects WiDS-named cache files)

## Usage

This Dockerfile is automatically used by the `.github/workflows/deploy_gradio_apps_sustainability.yml` workflow:

```bash
docker build -f Dockerfile.sustainability -t <image-name> .
```

## Cache Files

The WiDS cache files are generated by separate GitHub Actions workflows:
- `build_wids_cache.yml` - Generates `wids_prediction_cache.json.gz`
- `build_wids_full_models_cache.yml` - Generates `wids_prediction_cache_full_models.json.gz`

These cache files are downloaded as artifacts during the deployment workflow and embedded into the Docker image during the build process.

## Why a Separate Dockerfile?

The sustainability apps use a different prediction cache that is pre-computed from the WiDS dataset. To maintain clean separation and avoid confusion, we use a dedicated Dockerfile that:
1. Has clear naming conventions (wids_* vs prediction_*)
2. Uses a dedicated conversion script (convert_db_wids.py)
3. Is explicitly called by the sustainability deployment workflow

This approach ensures that:
- Each deployment type uses the correct cache files
- Build failures are clear and easy to debug
- The Docker build process is self-documenting

## Output

Both Dockerfiles produce the same SQLite database files:
- `prediction_cache.sqlite` - Base cache
- `prediction_cache_full.sqlite` - Combined/full cache

The apps read from these SQLite files at runtime for fast prediction lookups.
