FROM python:3.11-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY iatp/ /app/iatp/
COPY examples/ /app/examples/

# Set Python path
ENV PYTHONPATH=/app

# Health check endpoint will be provided by the agent
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  CMD python -c "import httpx; httpx.get('http://localhost:8000/health')"

# Run the agent based on environment variable
CMD if [ "$AGENT_TYPE" = "secure_bank" ]; then \
      python examples/secure_bank_agent.py; \
    elif [ "$AGENT_TYPE" = "untrusted" ]; then \
      python examples/untrusted_agent.py; \
    else \
      python examples/backend_agent.py; \
    fi
