#!/bin/bash
# Example usage of generate_dockerfile.py script
# Supports Python 3.7-3.12 with interactive selection

# Example 1: Interactive selection (default to all versions)
echo "Example 1: Interactive selection (press Enter for all versions)"
echo "Command: python3 scripts/generate_dockerfile.py --packages transformers pandas --image-tag my-maxframe:v1"
echo ""
python3 scripts/generate_dockerfile.py \
    --packages transformers pandas \
    --image-tag my-maxframe:v1 \
    --dry-run

echo -e "\n" + "="*80 + "\n"

# Example 2: All Python versions explicitly
echo "Example 2: All Python versions (explicit)"
echo "Command: python3 scripts/generate_dockerfile.py --packages transformers pandas --python-versions 3.7,3.8,3.9,3.10,3.11,3.12"
echo ""
python3 scripts/generate_dockerfile.py \
    --packages transformers pandas \
    --python-versions 3.7,3.8,3.9,3.10,3.11,3.12 \
    --image-tag my-maxframe-all:v1 \
    --dry-run

echo -e "\n" + "="*80 + "\n"

# Example 3: Specific Python versions
echo "Example 3: Specific Python versions (3.10, 3.11, 3.12)"
echo "Command: python3 scripts/generate_dockerfile.py --packages transformers torch --python-versions 3.10,3.11,3.12"
echo ""
python3 scripts/generate_dockerfile.py \
    --packages transformers torch \
    --python-versions 3.10,3.11,3.12 \
    --image-tag my-maxframe-recent:v1 \
    --dry-run

echo -e "\n" + "="*80 + "\n"

# Example 4: Single Python version
echo "Example 4: Single Python version (3.10)"
echo "Command: python3 scripts/generate_dockerfile.py --packages transformers torch --python-versions 3.10"
echo ""
python3 scripts/generate_dockerfile.py \
    --packages transformers torch \
    --python-versions 3.10 \
    --image-tag my-maxframe-py310:v1 \
    --dry-run

echo -e "\n" + "="*80 + "\n"

# Example 5: ML/AI packages with environment variables
echo "Example 5: ML/AI packages with environment variables"
echo "Command: python3 scripts/generate_dockerfile.py --packages pytorch torchvision transformers --env-vars '{\"TRANSFORMERS_CACHE\": \"/tmp/transformers\"}'"
echo ""
python3 scripts/generate_dockerfile.py \
    --packages pytorch torchvision transformers \
    --python-versions 3.10,3.11 \
    --env-vars '{"TRANSFORMERS_CACHE": "/tmp/transformers", "HF_HOME": "/tmp/huggingface"}' \
    --image-tag my-ml-runtime:v1 \
    --dry-run

echo -e "\n\nTo generate actual files:"
echo "1. Remove the --dry-run flag"
echo "2. Specify --output-dir (e.g., --output-dir ./my-runtime)"
echo "3. Run the command and follow interactive prompts"
echo ""
echo "Example:"
echo "  python3 scripts/generate_dockerfile.py \\"
echo "      --packages transformers torch \\"
echo "      --python-versions 3.10,3.11,3.12 \\"
echo "      --image-tag my-custom:v1 \\"
echo "      --output-dir ./my-runtime"
echo ""
echo "Then build:"
echo "  cd ./my-runtime"
echo "  docker build -t my-custom:v1 ."
echo ""
echo "Test:"
echo "  docker run --rm my-custom:v1 conda run -n py310 python --version"