@@ -19,6 +19,14 @@ RUN npm run build
19
19
# Stage 2: Python Backend
20
20
FROM docker.io/langchain/langgraph-api:3.11
21
21
22
+ # -- Install UV --
23
+ # First install curl, then install UV using the standalone installer
24
+ RUN apt-get update && apt-get install -y curl && \
25
+ curl -LsSf https://astral.sh/uv/install.sh | sh && \
26
+ apt-get clean && rm -rf /var/lib/apt/lists/*
27
+ ENV PATH="/root/.local/bin:$PATH"
28
+ # -- End of UV installation --
29
+
22
30
# -- Copy built frontend from builder stage --
23
31
# The app.py expects the frontend build to be at ../frontend/dist relative to its own location.
24
32
# If app.py is at /deps/backend/src/agent/app.py, then ../frontend/dist resolves to /deps/frontend/dist.
@@ -28,19 +36,28 @@ COPY --from=frontend-builder /app/frontend/dist /deps/frontend/dist
28
36
# -- Adding local package . --
29
37
ADD backend/ /deps/backend
30
38
# -- End of local package . --
31
-
32
- # -- Installing all local dependencies --
33
- RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir -c /api/constraints.txt -e /deps/backend
39
+
40
+ # -- Installing all local dependencies using UV --
41
+ # First, we need to ensure pip is available for UV to use
42
+ RUN uv pip install --system pip setuptools wheel
43
+ # Install dependencies with UV, respecting constraints
44
+ RUN cd /deps/backend && \
45
+ PYTHONDONTWRITEBYTECODE=1 UV_SYSTEM_PYTHON=1 uv pip install --system -c /api/constraints.txt -e .
34
46
# -- End of local dependencies install --
35
47
ENV LANGGRAPH_HTTP='{"app": "/deps/backend/src/agent/app.py:app"}'
36
48
ENV LANGSERVE_GRAPHS='{"agent": "/deps/backend/src/agent/graph.py:graph"}'
37
49
38
50
# -- Ensure user deps didn't inadvertently overwrite langgraph-api
39
- RUN mkdir -p /api/langgraph_api /api/langgraph_runtime /api/langgraph_license && touch /api/langgraph_api/__init__.py /api/langgraph_runtime/__init__.py /api/langgraph_license/__init__.py
51
+ # Create all required directories that the langgraph-api package expects
52
+ RUN mkdir -p /api/langgraph_api /api/langgraph_runtime /api/langgraph_license /api/langgraph_storage && \
53
+ touch /api/langgraph_api/__init__.py /api/langgraph_runtime/__init__.py /api/langgraph_license/__init__.py /api/langgraph_storage/__init__.py
54
+ # Use pip for this specific package as it has poetry-based build requirements
40
55
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir --no-deps -e /api
41
56
# -- End of ensuring user deps didn't inadvertently overwrite langgraph-api --
42
- # -- Removing pip from the final image ~<:===~~~ --
43
- RUN pip uninstall -y pip setuptools wheel && rm -rf /usr/local/lib/python*/site-packages/pip* /usr/local/lib/python*/site-packages/setuptools* /usr/local/lib/python*/site-packages/wheel* && find /usr/local/bin -name "pip*" -delete
57
+ # -- Removing pip from the final image (but keeping UV) --
58
+ RUN uv pip uninstall --system pip setuptools wheel && \
59
+ rm -rf /usr/local/lib/python*/site-packages/pip* /usr/local/lib/python*/site-packages/setuptools* /usr/local/lib/python*/site-packages/wheel* && \
60
+ find /usr/local/bin -name "pip*" -delete
44
61
# -- End of pip removal --
45
62
46
- WORKDIR /deps/backend
63
+ WORKDIR /deps/backend
0 commit comments