# Docker Image Archive Instructions

## Build Stage Archive Strategy

The multi-stage Dockerfile creates two images:
1. **Builder stage** (`soprano_to_rvc-rvc:builder`) - Contains all build tools and compiled dependencies (~85GB)
2. **Runtime stage** (`soprano_to_rvc-rvc:latest`) - Minimal runtime image (~15-20GB target)

### After Build Completes

Archive the builder stage to `/4TB/Docker/` for future reuse:

```bash
# 1. Tag the builder stage (it's created during multi-stage build)
docker tag $(docker images -q --filter "label=stage=builder" soprano_to_rvc-rvc) soprano_to_rvc-rvc:builder

# 2. Save the builder image to archive
mkdir -p /4TB/Docker
docker save soprano_to_rvc-rvc:builder | gzip > /4TB/Docker/soprano-rvc-builder-rocm6.4-pytorch2.5.1.tar.gz

# 3. Verify the archive
ls -lh /4TB/Docker/soprano-rvc-builder-rocm6.4-pytorch2.5.1.tar.gz

# 4. Check final runtime image size
docker images soprano_to_rvc-rvc:latest
```

### To Restore Builder from Archive

If you need to rebuild or modify dependencies later:

```bash
# Load the archived builder image
docker load < /4TB/Docker/soprano-rvc-builder-rocm6.4-pytorch2.5.1.tar.gz

# Use it as a base for modifications
docker run --rm -it soprano_to_rvc-rvc:builder bash
```

### Size Comparison

**Before (single-stage):**
- Image: `soprano_to_rvc-rvc:latest` = 85.7 GB

**After (multi-stage):**
- Builder (archived): ~50-60 GB (compressed to ~20-25 GB)
- Runtime: ~15-20 GB
- **Savings: ~65-70 GB on runtime image**

### What's Removed from Runtime

The runtime stage excludes:
- Build tools (gcc, g++, make, cmake)
- Development headers
- Git repositories
- pip cache
- Intermediate compilation artifacts
- Unused conda packages

### What's Kept in Runtime

The runtime stage includes:
- ROCm libraries (required for GPU)
- PyTorch 2.5.1+rocm6.4
- All Python packages from requirements-rvc.txt
- RVC models and application code
- Minimal system libraries (ffmpeg, libsndfile, curl)

## Archive Metadata

**Created:** 2026-01-15
**Base Image:** rocm/pytorch:rocm6.4_ubuntu22.04_py3.10_pytorch_release_2.5.1
**PyTorch Version:** 2.5.1+rocm6.4
**ROCm Version:** 6.4
**Python Version:** 3.10.x
**Target GPU:** AMD RX 6800 (gfx1030)
**Key Fix:** Apex removed (incompatible C++ extensions)
