Skip to content

Commit 99f745b

Browse files
committed
Fix Dockerfile
1 parent 5a8f89a commit 99f745b

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

Dockerfile

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ RUN npm run build
1919
# Stage 2: Python Backend
2020
FROM docker.io/langchain/langgraph-api:3.11
2121

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+
2230
# -- Copy built frontend from builder stage --
2331
# The app.py expects the frontend build to be at ../frontend/dist relative to its own location.
2432
# 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
2836
# -- Adding local package . --
2937
ADD backend/ /deps/backend
3038
# -- 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 .
3446
# -- End of local dependencies install --
3547
ENV LANGGRAPH_HTTP='{"app": "/deps/backend/src/agent/app.py:app"}'
3648
ENV LANGSERVE_GRAPHS='{"agent": "/deps/backend/src/agent/graph.py:graph"}'
3749

3850
# -- 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
4055
RUN PYTHONDONTWRITEBYTECODE=1 pip install --no-cache-dir --no-deps -e /api
4156
# -- 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
4461
# -- End of pip removal --
4562

46-
WORKDIR /deps/backend
63+
WORKDIR /deps/backend

0 commit comments

Comments
 (0)