| FROM python:3.12-slim |
|
|
| ENV DEBIAN_FRONTEND=noninteractive |
|
|
| RUN apt-get update && apt-get install -y \ |
| build-essential \ |
| git \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| WORKDIR /app |
|
|
| COPY . /app |
|
|
| RUN pip install --no-cache-dir PyYAML streamlit mistralai && pip install --no-cache-dir -e . && \ |
| python - <<'PY' |
| from pathlib import Path |
|
|
| path = Path("/app/cmbagent/utils/ocr.py") |
| text = path.read_text() |
|
|
| old = "from mistralai import Mistral, DocumentURLChunk" |
| new = """try: |
| from mistralai import Mistral, DocumentURLChunk |
| except Exception: |
| Mistral = None |
| DocumentURLChunk = None |
| """ |
|
|
| path.write_text(text.replace(old, new)) |
| PY |
|
|
| EXPOSE 7860 |
|
|
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] |