-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (42 loc) · 1.69 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (42 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# SCM hosted demo container.
#
# Builds the SCM REST API on Python 3.11 slim. The default image uses offline
# extraction and hash embeddings so it is self-contained and requires no LLM
# provider credentials or model download.
#
# To enable a stronger profile at deploy time:
# docker run -e LLM_PROVIDER=deepseek -e DEEPSEEK_API_KEY=... ...
# docker run -e LLM_PROVIDER=openai -e OPENAI_API_KEY=... ...
#
# Image is single-stage and intentionally minimal — no Ollama bundled
# (Ollama would balloon the image to ~5 GB; users pair with Ollama
# externally if they want Profile B).
FROM python:3.11-slim AS base
# Runtime health checks use curl. Build tools cover source-only dependencies.
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Layer caching: copy only what pip needs first
COPY pyproject.toml README.md LICENSE ./
COPY scm/ ./scm/
COPY src/ ./src/
# Pre-create the data dir SCM persists to
RUN mkdir -p /data && chmod 777 /data
# Install the package + its dependencies
RUN pip install --no-cache-dir -e .
# Reasonable production defaults
ENV SCM_DATA_DIR=/data \
SCM_EMBEDDING_BACKEND=hash \
SCM_AUTO_SLEEP_DISABLE=0 \
SCM_IDLE_THRESHOLD_SEC=300 \
SCM_MCP_SWEEP_INTERVAL_SEC=30 \
PYTHONUNBUFFERED=1 \
PORT=8000
EXPOSE 8000
# Health check uses the SCM /v1/health endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD curl -fs http://localhost:${PORT}/v1/health || exit 1
# Run the API server. Uvicorn binds to 0.0.0.0 so the container is reachable.
CMD ["sh", "-c", "uvicorn src.api.main:app --host 0.0.0.0 --port ${PORT} --workers 1"]