Langgraph api dockerfile with healthcheck
Skill kjuhwa/skills-hub/skills/build/langgraph-api-dockerfile-with-healthcheck
Production Dockerfile for a LangGraph agent that uses the official langchain/langgraph-api base image, installs the package against API constraints.txt, points LANGSERVE_GRAPHS at the build_graph factory, and includes a HEALTHCHECK using only stdlib urllib.From its SKILL.md
npx -y skills add kjuhwa/skills-hub --skill langgraph-api-dockerfile-with-healthcheckAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.7 KB, 531 tokens by cl100k_base, as published. Nobody here has run it
LangGraph API Dockerfile with Stdlib Healthcheck
When to use
You're deploying a LangGraph-based agent to a self-hosted Railway/EC2/ECS environment (not LangSmith Deployments). You need a slim Dockerfile that uses the official LangGraph API server, installs your agent's deps under the API's pinned constraints, and supports a Docker HEALTHCHECK without curl in the base image.
How it works
FROM langchain/langgraph-api:3.11provides the API server, port 2024, and/okhealth endpoint.pip install --no-cache-dir -c /api/constraints.txt /deps/agentpins all transitive deps to versions tested by the LangGraph maintainers.LANGSERVE_GRAPHSenv wires your agent factory by file:symbol path.- HEALTHCHECK uses
python -c "import urllib.request; urllib.request.urlopen('http://localhost:2024/ok', timeout=5)"— no curl/wget required in the image.
Example
FROM langchain/langgraph-api:3.11
ADD . /deps/agent
RUN PYTHONDONTWRITEBYTECODE=1 \
pip install --no-cache-dir -c /api/constraints.txt /deps/agent
# Intentionally omit custom auth here; self-hosted LangGraph does not
# support enterprise-only custom auth.
ENV LANGSERVE_GRAPHS='{"agent":"/deps/agent/app/graph_pipeline.py:build_graph"}'
WORKDIR /deps/agent
EXPOSE 2024
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:2024/ok', timeout=5)" || exit 1
Gotchas
--start-period=60sis critical — LangGraph's first-time DB migration can take 30+ seconds and the container would otherwise be marked unhealthy and recycled.- Pin against
/api/constraints.txtso a newer pydantic/langchain release doesn't break the API server in your image. PYTHONDONTWRITEBYTECODE=1shaves layer size by ~30% — no__pycache__directories.- Bind your
LANGSERVE_GRAPHSpath to a stable shim module (seelanggraph-compat-shim-import-path-preserved) so internal refactors don't require rebuilding the image config.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.