-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.api
More file actions
56 lines (45 loc) · 1.27 KB
/
Dockerfile.api
File metadata and controls
56 lines (45 loc) · 1.27 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
# Lightweight API Dockerfile
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd --create-home --shell /bin/bash appuser
# Copy source code
COPY src/ ./src/
COPY README.md ./
# Install only API dependencies (no heavy ML libs)
RUN pip install --no-cache-dir \
langchain>=0.3.0 \
langgraph>=0.2.0 \
langchain-openai>=0.2.0 \
langchain-groq>=0.2.0 \
langsmith>=0.1.0 \
yfinance>=0.2.40 \
qdrant-client>=1.9.0 \
duckduckgo-search>=6.0.0 \
fastapi>=0.111.0 \
"uvicorn[standard]>=0.30.0" \
pydantic>=2.7.0 \
pydantic-settings>=2.3.0 \
slowapi>=0.1.9 \
httpx>=0.27.0 \
tenacity>=8.4.0 \
python-dotenv>=1.0.0 \
structlog>=24.0.0 \
prometheus-client>=0.20.0
# Set ownership
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Environment
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONPATH=/app
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
EXPOSE 8000
CMD ["uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8000"]