# Google Vertex AI custom-prediction container for predictive-regression.
# Vertex expects: /health (GET) and /predict (POST) on $AIP_HTTP_PORT (default 8080).

FROM python:3.11-slim

WORKDIR /app

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

COPY . .

# Train the toy model at build time so the image is self-contained. In a
# real deployment, replace this with a COPY of the artifact you built in
# your training pipeline (e.g. gs://<bucket>/model.pkl -> /app/model.pkl).
RUN python train_model.py

EXPOSE 8080

CMD ["sh", "-c", "uvicorn predictor:app --host 0.0.0.0 --port ${AIP_HTTP_PORT:-8080}"]
