FROM ghcr.io/astral-sh/uv:latest as uv
FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04

# Install minimal dependencies for uv
RUN apt-get update && apt-get install -y \
    curl \
    ca-certificates \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Copy uv
COPY --from=uv /uv /uvx /bin/

# Install Python 3.13 using uv
RUN uv python install 3.13

# Create simple test script
WORKDIR /app
RUN echo '#!/usr/bin/env python3\n\
import torch\n\
print(f"PyTorch version: {torch.__version__}")\n\
print(f"CUDA available: {torch.cuda.is_available()}")\n\
if torch.cuda.is_available():\n\
    print(f"CUDA device: {torch.cuda.get_device_name(0)}")\n\
    print(f"CUDA version: {torch.version.cuda}")' > test_pytorch.py

# Run with inline dependencies
CMD ["uv", "run", "--with", "torch", "--with", "torchvision", \
     "--index", "https://download.pytorch.org/whl/cu128", \
     "python", "test_pytorch.py"]