-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (34 loc) · 1.32 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (34 loc) · 1.32 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
# === Builder stage ===
FROM python:3.11-slim AS builder
WORKDIR /build
RUN pip install --no-cache-dir uv
COPY pyproject.toml README.md ./
COPY src/ src/
# Install production dependencies only (no dev extras)
RUN uv pip install --system --no-cache "." \
&& uv pip install --system --no-cache ".[embedding]"
# === Runtime stage ===
FROM python:3.11-slim
WORKDIR /app
# Install curl for healthcheck
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -r tmh && useradd -r -g tmh -u 1000 -m tmh
# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy source code
COPY src/ src/
COPY pyproject.toml .
COPY tmh.toml.example tmh.toml
COPY main.py .
# Create data directory with correct ownership
RUN mkdir -p /app/data && chown -R tmh:tmh /app/data /app/tmh.toml
# Switch to non-root user
USER tmh
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8000/api/v1/health || exit 1
CMD ["uvicorn", "team_memory_hub.server.app:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000"]