forked from llm-d-incubation/llm-d-planner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (43 loc) · 1.69 KB
/
Dockerfile
File metadata and controls
58 lines (43 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
53
54
55
56
57
58
# Backend Dockerfile for NeuralNav
FROM --platform=linux/amd64 python:3.11-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
gcc \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Copy dependency files and README (hatchling requires README.md for package metadata)
COPY pyproject.toml uv.lock README.md ./
# Install Python dependencies (frozen = use lockfile exactly, no-dev = skip dev deps)
RUN uv sync --frozen --no-dev --extra cluster
# Copy backend source code
COPY src/neuralnav ./src/neuralnav
# Copy data files (Knowledge Base)
COPY data ./data
# Copy scripts (schema init, benchmark loading — used by db-init Job)
COPY scripts ./scripts
# Create non-root user and directories for generated files
RUN groupadd --gid 1001 appuser && \
useradd --uid 1001 --gid 0 --no-create-home appuser && \
mkdir -p /app/generated_configs /app/logs/prompts && \
chown -R appuser:0 /app && \
chmod -R g=u /app/generated_configs /app/logs
# Set environment variables
ENV PYTHONPATH=/app/src
ENV PYTHONUNBUFFERED=1
# Use the venv created by uv sync (avoids uv run writing to .venv at runtime)
ENV PATH="/app/.venv/bin:$PATH"
ARG MODEL_CATALOG_URL
# Switch to non-root user
USER appuser
# Expose backend API port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8000/health').raise_for_status()" || exit 1
# Run the backend API server
CMD ["uvicorn", "neuralnav.api.app:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]