|
|
|
|
|
|
|
|
|
|
| FROM python:3.11-slim AS builder
|
|
|
| WORKDIR /app
|
|
|
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| build-essential \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| COPY requirements.txt .
|
|
|
|
|
| RUN python -m venv /opt/venv
|
| ENV PATH="/opt/venv/bin:$PATH"
|
| RUN pip install --no-cache-dir --upgrade pip && \
|
| pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
| FROM python:3.11-slim AS production
|
|
|
|
|
| LABEL maintainer="MnemoCore Team"
|
| LABEL description="MnemoCore - Infrastructure for Persistent Cognitive Memory"
|
| LABEL version="4.5.0"
|
|
|
|
|
| RUN groupadd --gid 1000 mnemocore && \
|
| useradd --uid 1000 --gid mnemocore --shell /bin/bash --create-home mnemocore
|
|
|
| WORKDIR /app
|
|
|
|
|
| COPY --from=builder /opt/venv /opt/venv
|
| ENV PATH="/opt/venv/bin:$PATH"
|
|
|
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| curl \
|
| && rm -rf /var/lib/apt/lists/* \
|
| && apt-get clean
|
|
|
|
|
| COPY --chown=mnemocore:mnemocore src/ ./src/
|
| COPY --chown=mnemocore:mnemocore config.yaml .
|
| COPY --chown=mnemocore:mnemocore scripts/ ./scripts/
|
|
|
|
|
| RUN mkdir -p /app/data && chown -R mnemocore:mnemocore /app/data
|
|
|
|
|
| USER mnemocore
|
|
|
|
|
| ENV PYTHONUNBUFFERED=1 \
|
| PYTHONDONTWRITEBYTECODE=1 \
|
| HAIM_API_KEY="" \
|
| REDIS_URL="redis://redis:6379/0" \
|
| QDRANT_URL="http://qdrant:6333" \
|
| LOG_LEVEL="INFO" \
|
| HOST="0.0.0.0" \
|
| PORT="8100"
|
|
|
|
|
| EXPOSE 8100
|
|
|
|
|
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
| CMD python /app/scripts/healthcheck.py || exit 1
|
|
|
|
|
| ENTRYPOINT ["uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8100"]
|
| CMD ["--workers", "1", "--log-level", "info"]
|
|
|