mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-01 02:02:20 +00:00
The Next.js bundle under litellm/proxy/_experimental/out has historically been checked into the repository so the proxy could ship a pre-built dashboard. This bloated the repo (~21 MB of generated artifacts) and made every UI PR unreviewable because npm-rebuilt hashed asset filenames showed up as massive diffs. Wire every code path that produces a distributable artifact to rebuild the UI from source instead: - docker/build_admin_ui.sh now always builds the UI (no more enterprise-only early exit), copies it to litellm/proxy/_experimental/out, and restructures HTML so extensionless /ui routes work. - docker/Dockerfile.alpine and docker/Dockerfile.non_root now invoke build_admin_ui.sh (the other Dockerfiles already did). non_root drops its bespoke restructure loop since the build script handles it. - .github/workflows/publish_to_pypi.yml builds the UI before 'uv build' so the published wheel/sdist still ships the dashboard. - ui/litellm-dashboard/build_ui.sh creates the destination dir if missing and restructures HTML routes the same way the Docker pipeline does. - ui/litellm-dashboard/build_release_ui.sh no longer commits artifacts to git; it just delegates to docker/build_admin_ui.sh. Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
71 lines
2.3 KiB
Text
71 lines
2.3 KiB
Text
# Base image for building
|
|
ARG LITELLM_BUILD_IMAGE=python:3.11-alpine@sha256:f07e2ace46f560f09a6eeec7b4913b80ee99546e749ef82342a419a326620856
|
|
|
|
# Runtime image
|
|
ARG LITELLM_RUNTIME_IMAGE=python:3.11-alpine@sha256:f07e2ace46f560f09a6eeec7b4913b80ee99546e749ef82342a419a326620856
|
|
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
|
|
|
|
FROM $UV_IMAGE AS uvbin
|
|
|
|
FROM $LITELLM_BUILD_IMAGE AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=uvbin /uv /usr/local/bin/uv
|
|
COPY --from=uvbin /uvx /usr/local/bin/uvx
|
|
|
|
RUN apk add --no-cache gcc python3-dev musl-dev nodejs npm libsndfile
|
|
|
|
ENV PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \
|
|
UV_PROJECT_ENVIRONMENT=/app/.venv \
|
|
UV_LINK_MODE=copy \
|
|
XDG_CACHE_HOME=/app/.cache \
|
|
PATH="/app/.venv/bin:${PATH}"
|
|
|
|
# Copy dependency metadata first for layer caching
|
|
COPY pyproject.toml uv.lock ./
|
|
COPY enterprise/pyproject.toml enterprise/
|
|
COPY litellm-proxy-extras/pyproject.toml litellm-proxy-extras/
|
|
|
|
# Install third-party dependencies (cached unless pyproject.toml/uv.lock change)
|
|
RUN uv sync --frozen --no-install-project --no-install-workspace --no-default-groups --no-editable \
|
|
--extra proxy \
|
|
--extra proxy-runtime \
|
|
--extra extra_proxy \
|
|
--extra semantic-router \
|
|
--python python3
|
|
|
|
# Copy full source tree
|
|
COPY . .
|
|
|
|
# Build Admin UI before final sync
|
|
RUN sed -i 's/\r$//' docker/build_admin_ui.sh && chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
|
|
|
|
# Install project and workspace packages (fast - deps already cached)
|
|
RUN uv sync --frozen --no-default-groups --no-editable \
|
|
--extra proxy \
|
|
--extra proxy-runtime \
|
|
--extra extra_proxy \
|
|
--extra semantic-router \
|
|
--python python3
|
|
|
|
RUN prisma generate --schema=./schema.prisma
|
|
|
|
RUN sed -i 's/\r$//' docker/entrypoint.sh && chmod +x docker/entrypoint.sh && \
|
|
sed -i 's/\r$//' docker/prod_entrypoint.sh && chmod +x docker/prod_entrypoint.sh
|
|
|
|
FROM $LITELLM_RUNTIME_IMAGE AS runtime
|
|
|
|
RUN apk upgrade --no-cache && apk add --no-cache libsndfile nodejs npm
|
|
|
|
WORKDIR /app
|
|
ENV PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \
|
|
XDG_CACHE_HOME=/app/.cache \
|
|
PATH="/app/.venv/bin:${PATH}"
|
|
|
|
COPY --from=builder /app /app
|
|
|
|
EXPOSE 4000/tcp
|
|
|
|
ENTRYPOINT ["docker/prod_entrypoint.sh"]
|
|
CMD ["--port", "4000"]
|