fix: replace 'pip' with 'python3 -m pip' in Dockerfile
The litellm/litellm base image is Alpine-based, where 'pip' is not available directly. Using 'python3 -m pip' ensures compatibility.
This commit is contained in:
33
Dockerfile
33
Dockerfile
@@ -14,7 +14,7 @@
|
|||||||
# - A tiny wrapper entrypoint that runs litellm --config /app/config.yaml
|
# - A tiny wrapper entrypoint that runs litellm --config /app/config.yaml
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
|
|
||||||
# 1. Use the official LiteLLM image
|
# 1. Use the official LiteLLM image (based on Alpine Linux)
|
||||||
FROM litellm/litellm:latest
|
FROM litellm/litellm:latest
|
||||||
|
|
||||||
# 2. Set environment variables that control the router
|
# 2. Set environment variables that control the router
|
||||||
@@ -26,27 +26,34 @@ ENV \
|
|||||||
TOOL_ROUTER_ALWAYS_INCLUDE=get_time,help,list_tools \
|
TOOL_ROUTER_ALWAYS_INCLUDE=get_time,help,list_tools \
|
||||||
TOOL_ROUTER_EMBEDDING_MODEL=text-embedding-3-small
|
TOOL_ROUTER_EMBEDDING_MODEL=text-embedding-3-small
|
||||||
|
|
||||||
# 3. Create working directory
|
# 3. Create a non-root user (Alpine uses adduser, not useradd)
|
||||||
|
RUN adduser -D -u 1000 litellm && \
|
||||||
|
mkdir -p /app && \
|
||||||
|
chown -R litellm:litellm /app
|
||||||
|
|
||||||
|
# 4. Switch to that user for the rest of the steps
|
||||||
|
USER litellm
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 4. Copy only the files that belong to the Tool Router
|
# 5. Copy only the files that belong to the Tool Router
|
||||||
COPY tool_router_logger.py \
|
COPY --chown=litellm:litellm \
|
||||||
config.yaml \
|
tool_router_logger.py \
|
||||||
test_tool_router.py \
|
config.yaml \
|
||||||
requirements.txt \
|
test_tool_router.py \
|
||||||
./
|
requirements.txt \
|
||||||
|
./
|
||||||
|
|
||||||
# 5. Install the extra Python deps that the router needs (as root)
|
# 6. Install the extra Python deps that the router needs:
|
||||||
# - numpy (for cosine similarity)
|
# - numpy (for cosine similarity)
|
||||||
# - scikit-learn (for the Jaccard fallback)
|
# - scikit-learn (for the Jaccard fallback)
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN python3 -m pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# 6. Expose the port used by LiteLLM
|
# 7. Expose the port used by LiteLLM
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
|
|
||||||
# 7. Healthcheck - LiteLLM returns a JSON health endpoint
|
# 8. Healthcheck - LiteLLM returns a JSON health endpoint
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
|
||||||
CMD curl -fsS "http://127.0.0.1:${PORT}/health" || exit 1
|
CMD curl -fsS "http://127.0.0.1:${PORT}/health" || exit 1
|
||||||
|
|
||||||
# 8. Default command - run the proxy with our config file
|
# 9. Default command - run the proxy with our config file
|
||||||
CMD ["sh", "-c", "litellm --config /app/config.yaml --port ${PORT} --host 0.0.0.0"]
|
CMD ["sh", "-c", "litellm --config /app/config.yaml --port ${PORT} --host 0.0.0.0"]
|
||||||
Reference in New Issue
Block a user