FROM python:3.11-slim
ARG NEXUS_PYPI=https://pypi.org/simple
ARG NEXUS_TORCH=https://download.pytorch.org/whl/cpu
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl libgomp1 \
&& rm -rf /var/lib/apt/lists/*
COPY app/requirements.txt .
RUN pip install --no-cache-dir \
--index-url ${NEXUS_PYPI} \
--extra-index-url ${NEXUS_TORCH} \
torch==2.3.1+cpu && \
pip install --no-cache-dir \
--index-url ${NEXUS_PYPI} \
-r requirements.txt && \
pip cache purge
COPY app/main.py .
RUN useradd -m -u 1000 app && chown -R app:app /app
USER app
EXPOSE 8501
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8501/_stcore/health || exit 1
ENV OLLAMA_BASE_URL="http://ollama-svc:11434" \
OLLAMA_MODEL="llama3" \
MILVUS_HOST="milvus-svc" \
MILVUS_PORT="19530" \
COLLECTION_NAME="aistor_docs" \
EMBEDDING_MODEL_PATH="/app/models/all-MiniLM-L6-v2" \
RETRIEVER_K="3" \
STREAMLIT_SERVER_PORT="8501" \
STREAMLIT_SERVER_ADDRESS="0.0.0.0" \
STREAMLIT_SERVER_HEADLESS="true" \
STREAMLIT_BROWSER_GATHER_USAGE_STATS="false" \
PYTHONUNBUFFERED="1"
CMD ["streamlit", "run", "main.py"]