Spaces:
Running
Running
github-actions[bot] commited on
Commit ·
f526e24
1
Parent(s): 4b38049
deploy: 26795e0 — 更新 Dockerfile.huggingface
Browse files- Dockerfile +23 -2
- Dockerfile.huggingface +23 -2
Dockerfile
CHANGED
|
@@ -11,6 +11,16 @@
|
|
| 11 |
# [Bug2] build-essential for better-sqlite3 node-gyp fallback
|
| 12 |
# [Bug3] npm install --omit=dev (--only=production deprecated in npm v10)
|
| 13 |
# [Bug5] ARG LITELLM_VERSION for single-source versioning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
FROM node:20-alpine AS frontend-builder
|
| 16 |
WORKDIR /build
|
|
@@ -33,7 +43,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 33 |
&& apt-get purge -y gnupg && apt-get autoremove -y \
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 39 |
|
|
@@ -63,4 +84,4 @@ RUN chmod +x /app/huggingface/entrypoint.sh
|
|
| 63 |
USER user
|
| 64 |
WORKDIR /app
|
| 65 |
EXPOSE 7860
|
| 66 |
-
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
|
|
|
| 11 |
# [Bug2] build-essential for better-sqlite3 node-gyp fallback
|
| 12 |
# [Bug3] npm install --omit=dev (--only=production deprecated in npm v10)
|
| 13 |
# [Bug5] ARG LITELLM_VERSION for single-source versioning
|
| 14 |
+
# [BugP] prisma generate — LiteLLM v1.61+ initialises its Prisma client at
|
| 15 |
+
# lifespan startup whenever database_url is present in config. The
|
| 16 |
+
# Prisma CLI (installed as part of litellm[proxy]) requires generated
|
| 17 |
+
# binary artefacts to exist before the process starts. Without this
|
| 18 |
+
# step the container crashes immediately with:
|
| 19 |
+
# ModuleNotFoundError: No module named 'prisma'
|
| 20 |
+
# Exception: Unable to find Prisma binaries.
|
| 21 |
+
# Please run 'prisma generate' first.
|
| 22 |
+
# Fix: locate LiteLLM's bundled schema.prisma at build time and run
|
| 23 |
+
# prisma generate so the engine binaries are baked into the image.
|
| 24 |
|
| 25 |
FROM node:20-alpine AS frontend-builder
|
| 26 |
WORKDIR /build
|
|
|
|
| 43 |
&& apt-get purge -y gnupg && apt-get autoremove -y \
|
| 44 |
&& rm -rf /var/lib/apt/lists/*
|
| 45 |
|
| 46 |
+
# BUG FIX [BugP]: Run prisma generate immediately after pip install.
|
| 47 |
+
# LiteLLM[proxy] installs the prisma Python package and CLI, but the Prisma
|
| 48 |
+
# engine binaries are not shipped with the package — they must be generated
|
| 49 |
+
# from the schema. LiteLLM bundles its own schema at:
|
| 50 |
+
# <litellm_package_dir>/proxy/schema.prisma
|
| 51 |
+
# We locate it dynamically so the path stays correct across LiteLLM versions.
|
| 52 |
+
RUN pip install --no-cache-dir "litellm[proxy]==${LITELLM_VERSION}" \
|
| 53 |
+
&& SCHEMA_PATH=$(python3 -c \
|
| 54 |
+
"import litellm, os; \
|
| 55 |
+
print(os.path.join(os.path.dirname(litellm.__file__), 'proxy', 'schema.prisma'))") \
|
| 56 |
+
&& echo "Running: prisma generate --schema ${SCHEMA_PATH}" \
|
| 57 |
+
&& prisma generate --schema "${SCHEMA_PATH}"
|
| 58 |
|
| 59 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 60 |
|
|
|
|
| 84 |
USER user
|
| 85 |
WORKDIR /app
|
| 86 |
EXPOSE 7860
|
| 87 |
+
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
Dockerfile.huggingface
CHANGED
|
@@ -11,6 +11,16 @@
|
|
| 11 |
# [Bug2] build-essential for better-sqlite3 node-gyp fallback
|
| 12 |
# [Bug3] npm install --omit=dev (--only=production deprecated in npm v10)
|
| 13 |
# [Bug5] ARG LITELLM_VERSION for single-source versioning
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
FROM node:20-alpine AS frontend-builder
|
| 16 |
WORKDIR /build
|
|
@@ -33,7 +43,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 33 |
&& apt-get purge -y gnupg && apt-get autoremove -y \
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 39 |
|
|
@@ -63,4 +84,4 @@ RUN chmod +x /app/huggingface/entrypoint.sh
|
|
| 63 |
USER user
|
| 64 |
WORKDIR /app
|
| 65 |
EXPOSE 7860
|
| 66 |
-
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|
|
|
|
| 11 |
# [Bug2] build-essential for better-sqlite3 node-gyp fallback
|
| 12 |
# [Bug3] npm install --omit=dev (--only=production deprecated in npm v10)
|
| 13 |
# [Bug5] ARG LITELLM_VERSION for single-source versioning
|
| 14 |
+
# [BugP] prisma generate — LiteLLM v1.61+ initialises its Prisma client at
|
| 15 |
+
# lifespan startup whenever database_url is present in config. The
|
| 16 |
+
# Prisma CLI (installed as part of litellm[proxy]) requires generated
|
| 17 |
+
# binary artefacts to exist before the process starts. Without this
|
| 18 |
+
# step the container crashes immediately with:
|
| 19 |
+
# ModuleNotFoundError: No module named 'prisma'
|
| 20 |
+
# Exception: Unable to find Prisma binaries.
|
| 21 |
+
# Please run 'prisma generate' first.
|
| 22 |
+
# Fix: locate LiteLLM's bundled schema.prisma at build time and run
|
| 23 |
+
# prisma generate so the engine binaries are baked into the image.
|
| 24 |
|
| 25 |
FROM node:20-alpine AS frontend-builder
|
| 26 |
WORKDIR /build
|
|
|
|
| 43 |
&& apt-get purge -y gnupg && apt-get autoremove -y \
|
| 44 |
&& rm -rf /var/lib/apt/lists/*
|
| 45 |
|
| 46 |
+
# BUG FIX [BugP]: Run prisma generate immediately after pip install.
|
| 47 |
+
# LiteLLM[proxy] installs the prisma Python package and CLI, but the Prisma
|
| 48 |
+
# engine binaries are not shipped with the package — they must be generated
|
| 49 |
+
# from the schema. LiteLLM bundles its own schema at:
|
| 50 |
+
# <litellm_package_dir>/proxy/schema.prisma
|
| 51 |
+
# We locate it dynamically so the path stays correct across LiteLLM versions.
|
| 52 |
+
RUN pip install --no-cache-dir "litellm[proxy]==${LITELLM_VERSION}" \
|
| 53 |
+
&& SCHEMA_PATH=$(python3 -c \
|
| 54 |
+
"import litellm, os; \
|
| 55 |
+
print(os.path.join(os.path.dirname(litellm.__file__), 'proxy', 'schema.prisma'))") \
|
| 56 |
+
&& echo "Running: prisma generate --schema ${SCHEMA_PATH}" \
|
| 57 |
+
&& prisma generate --schema "${SCHEMA_PATH}"
|
| 58 |
|
| 59 |
RUN useradd -m -u 1000 -s /bin/bash user
|
| 60 |
|
|
|
|
| 84 |
USER user
|
| 85 |
WORKDIR /app
|
| 86 |
EXPOSE 7860
|
| 87 |
+
ENTRYPOINT ["/app/huggingface/entrypoint.sh"]
|