# Dockerfile — package the app into a container so it runs the same everywhere.
# (Callback to Course 01: a container bundles the app + its exact dependencies.)

# Pin Python 3.12 — current enough, and avoids the newest-Python wheel problems (M7/M9).
FROM python:3.12-slim

WORKDIR /app

# Install dependencies first (this layer is cached unless requirements.txt changes).
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Then copy the app code.
COPY app.py .

# The container listens on port 8000.
EXPOSE 8000

# Start the server. 0.0.0.0 makes it reachable from outside the container.
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]

# Build:  docker build -t ai-app .
# Run:    docker run -p 8000:8000 --env-file .env ai-app
#   (--env-file passes your ANTHROPIC_API_KEY at RUN time — the key is NEVER baked
#    into the image; .dockerignore keeps .env out of the build entirely.)
