This document describes the available Docker image variants for transcript-create and their use cases.
transcript-create provides three optimized Docker image variants:
- ROCm - AMD GPU acceleration (default)
- CPU - CPU-only for development/testing
- CUDA - NVIDIA GPU acceleration
All variants use multi-stage builds for optimal image size and build time.
File: Dockerfile
Base Image: rocm/dev-ubuntu-22.04:6.0.2
Target Size: <2.5GB (down from ~3GB)
Use Cases:
- Production deployments with AMD GPUs
- RDNA/GCN architecture support
- High-performance transcription
Build:
# Using build script (recommended)
./scripts/build-rocm.sh [rocm_version] [--no-cache] [--push]
# Examples
./scripts/build-rocm.sh # Build with ROCm 6.0
./scripts/build-rocm.sh 6.1 # Build with ROCm 6.1
./scripts/build-rocm.sh 6.0 --no-cache # Build without cache
# Using docker directly
docker build -t transcript-create:rocm6.0 \
--build-arg ROCM_WHEEL_INDEX=https://download.pytorch.org/whl/rocm6.0 \
-f Dockerfile .Run:
docker run -p 8000:8000 \
--device=/dev/kfd --device=/dev/dri \
--group-add video \
-v ./data:/data \
-v ./cache:/root/.cache \
transcript-create:rocm6.0Supported ROCm Versions:
- 6.0 (default)
- 6.1
- 6.2
File: Dockerfile.cpu
Base Image: python:3.11-slim
Target Size: ~8GB (Note: Larger than 1GB due to comprehensive dependencies. For minimal image, use requirements-minimal.txt excluding pyannote and other optional features)
Use Cases:
- Development and testing
- CI/CD pipelines
- CPU-based inference (slower but no GPU required)
- Environments without GPU access
Build:
# Using build script (recommended)
./scripts/build-cpu.sh [--no-cache] [--push]
# Examples
./scripts/build-cpu.sh # Build with cache
./scripts/build-cpu.sh --no-cache # Build without cache
# Using docker directly
docker build -t transcript-create:cpu -f Dockerfile.cpu .Run:
docker run -p 8000:8000 \
-v ./data:/data \
-v ./cache:/root/.cache \
transcript-create:cpuFeatures:
- Image size ~8GB by default (can be reduced by using requirements-minimal.txt and excluding optional dependencies)
- No GPU dependencies
- Faster build times
- Ideal for development
File: Dockerfile.cuda
Base Image: nvidia/cuda:12.1.0-runtime-ubuntu22.04
Target Size: ~2.5GB
Use Cases:
- Production deployments with NVIDIA GPUs
- CUDA-accelerated inference
- Maximum performance on NVIDIA hardware
Build:
# Using build script (recommended)
./scripts/build-cuda.sh [cuda_version] [--no-cache] [--push]
# Examples
./scripts/build-cuda.sh # Build with CUDA 12.1
./scripts/build-cuda.sh 11.8 # Build with CUDA 11.8
./scripts/build-cuda.sh --no-cache # Build without cache
# Using docker directly
docker build -t transcript-create:cuda12.1 \
--build-arg CUDA_WHEEL_INDEX=https://download.pytorch.org/whl/cu121 \
-f Dockerfile.cuda .Run:
docker run -p 8000:8000 \
--gpus all \
-v ./data:/data \
-v ./cache:/root/.cache \
transcript-create:cuda12.1Supported CUDA Versions:
- 12.1 (default, recommended)
- 11.8
Requirements:
- NVIDIA GPU
- NVIDIA Container Toolkit
- CUDA-compatible drivers
All variants support the following build arguments:
ROCM_WHEEL_INDEX- PyTorch wheel index URL (default: rocm6.0)
CUDA_WHEEL_INDEX- PyTorch wheel index URL (default: cu121)
All variants use a three-stage build process:
- Base Stage - System dependencies and base image
- Python Dependencies Stage - Install Python packages
- Application Stage - Copy application code and finalize
This architecture provides:
- Layer caching - Rebuild only changed layers
- Smaller images - Only production dependencies in final stage
- Faster builds - Parallel builds with BuildKit
- Better security - Minimal attack surface
All variants use BuildKit cache mounts for pip:
RUN --mount=type=cache,target=/root/.cache/pip \
pip3 install --no-cache-dir -r requirements.txtThis persists pip's cache across builds, dramatically speeding up rebuilds.
Layers are ordered by change frequency:
- System packages (rarely change)
- Python dependencies (change occasionally)
- Application code (change frequently)
This maximizes cache hits during development.
- Remove apt cache:
rm -rf /var/lib/apt/lists/* - Use
--no-install-recommendsfor apt - Install only required system packages
- Pre-compile Python files
- Exclude unnecessary files via
.dockerignore
PYTHONUNBUFFERED=1- Real-time loggingPYTHONDONTWRITEBYTECODE=1- No .pyc filesHF_HOME=/root/.cache/hf- Hugging Face cachePDF_FONT_PATH=/app/fonts/DejaVuSerif.ttf- PDF font path
FORCE_GPU=true- Force GPU usageWHISPER_BACKEND=whisper- Use PyTorch backend
FORCE_GPU=false- CPU-only modeWHISPER_BACKEND=faster-whisper- Use faster-whisper backend
FORCE_GPU=true- Force GPU usageWHISPER_BACKEND=whisper- Use PyTorch backendNVIDIA_VISIBLE_DEVICES=all- All GPUs visibleNVIDIA_DRIVER_CAPABILITIES=compute,utility- GPU capabilities
All variants include health checks:
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1This enables:
- Container orchestration (Kubernetes, Docker Compose)
- Automatic restart on failure
- Load balancer health monitoring
| Variant | Image Size | Build Time (no cache) | Build Time (cached) | Inference Speed |
|---|---|---|---|---|
| ROCm 6.0 | ~2.3GB* | 15-20 min | 2-5 min | Fast (GPU) |
| CPU | ~8GB** | 8-12 min | 1-3 min | Slow (CPU) |
| CUDA 12.1 | ~2.4GB* | 15-20 min | 2-5 min | Fastest (GPU) |
Note: Image sizes depend on the dependencies in requirements.txt. The GPU variants (ROCm/CUDA) are optimized but include necessary libraries.
*Note: The CPU variant is larger than initially targeted (<1GB) due to the comprehensive dependencies in requirements.txt, which include pyannote.audio and other heavy packages. For a truly minimal CPU image (<1GB), consider creating a requirements-minimal.txt that excludes diarization and other optional features.
Build times measured on GitHub Actions runners with BuildKit caching
The Docker build workflow (.github/workflows/docker-build.yml) automatically:
- Builds the ROCm variant on push to main
- Uses GitHub Actions cache for faster builds
- Pushes to GitHub Container Registry
- Generates SBOMs and attestations
- Signs images (optional)
To build all variants locally:
# Build all variants
./scripts/build-rocm.sh
./scripts/build-cpu.sh
./scripts/build-cuda.sh
# Or with docker-compose
docker-compose buildAll variants:
- ✅ Run as root (required for volume permissions in docker-compose)
- ✅ Include health checks
- ✅ Use specific version tags (no
latestin production) - ✅ Minimize installed packages
- ✅ Clean apt cache
For production deployments with non-root users, consider:
- Using Kubernetes security contexts
- Running with user namespace remapping
- Using read-only root filesystems
If builds fail with cache mount errors:
export DOCKER_BUILDKIT=1
docker build ...If you encounter permission issues with mounted volumes:
# Fix ownership
sudo chown -R $USER:$USER ./data ./cacheROCm:
# Check devices
ls -la /dev/kfd /dev/dri
# Check group membership
groups | grep video
# Add user to video group
sudo usermod -a -G video $USERCUDA:
# Check NVIDIA runtime
docker run --rm --gpus all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi
# Install NVIDIA Container Toolkit if needed
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker- Use variant-specific tags - Don't use
latestin production - Enable BuildKit - For faster builds and cache mounts
- Mount volumes - Persist data and model caches
- Monitor health - Use health check endpoints
- Security scanning - Run Trivy scans before deployment
- Resource limits - Set memory/CPU limits in production