From 00ac213080d99a70f38706f62bef3293746aaedd Mon Sep 17 00:00:00 2001 From: CM Consultor Date: Thu, 6 Aug 2026 22:34:52 +0000 Subject: [PATCH] fix: simplificar Dockerfile - instalar deps como root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remover criação de usuário não-root (evita problemas com pip) - Instalar dependências antes de trocar de usuário - Imagem oficial já roda como usuário apropriado - Pip não estava disponível no PATH do usuário litellm --- Dockerfile | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6a48dc..aca60a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ # - A tiny wrapper entrypoint that runs litellm --config /app/config.yaml # --------------------------------------------------------------- -# 1. Use the official LiteLLM image (based on Alpine Linux) +# 1. Use the official LiteLLM image FROM litellm/litellm:latest # 2. Set environment variables that control the router @@ -26,34 +26,27 @@ ENV \ TOOL_ROUTER_ALWAYS_INCLUDE=get_time,help,list_tools \ TOOL_ROUTER_EMBEDDING_MODEL=text-embedding-3-small -# 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 +# 3. Create working directory WORKDIR /app -# 5. Copy only the files that belong to the Tool Router -COPY --chown=litellm:litellm \ - tool_router_logger.py \ - config.yaml \ - test_tool_router.py \ - requirements.txt \ - ./ +# 4. Copy only the files that belong to the Tool Router +COPY tool_router_logger.py \ + config.yaml \ + test_tool_router.py \ + requirements.txt \ + ./ -# 6. Install the extra Python deps that the router needs: +# 5. Install the extra Python deps that the router needs (as root) # - numpy (for cosine similarity) # - scikit-learn (for the Jaccard fallback) RUN pip install --no-cache-dir -r requirements.txt -# 7. Expose the port used by LiteLLM +# 6. Expose the port used by LiteLLM EXPOSE 4000 -# 8. Healthcheck - LiteLLM returns a JSON health endpoint +# 7. Healthcheck - LiteLLM returns a JSON health endpoint HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ CMD curl -fsS "http://127.0.0.1:${PORT}/health" || exit 1 -# 9. Default command - run the proxy with our config file +# 8. Default command - run the proxy with our config file CMD ["sh", "-c", "litellm --config /app/config.yaml --port ${PORT} --host 0.0.0.0"]