Skip to content

Commit 626c49c

Browse files
committed
Strip proprietary enterprise code from published images
enterprise/LICENSE.md forbids redistribution without a BerriAI subscription; the rest of LiteLLM is MIT. Remove the litellm-enterprise package and /app/enterprise so the published images are MIT-only, and smoke-check that the proxy still imports without them (all litellm imports of litellm_enterprise are ImportError-guarded).
1 parent 4ded21a commit 626c49c

2 files changed

Lines changed: 31 additions & 12 deletions

File tree

Dockerfile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@ ARG LITELLM_IMAGE=ghcr.io/berriai/litellm
55
ARG LITELLM_VERSION=v1.93.0
66
FROM ${LITELLM_IMAGE}:${LITELLM_VERSION}
77

8-
# Apply patch/*.patch onto the installed litellm package. Only litellm/*
9-
# paths are applied — tests/ and ui/ sources in a patch are skipped (the
10-
# image ships prebuilt UI assets, so ui/ source changes are inert anyway).
11-
# With no *.patch files present this is a no-op and the image is a 1-to-1
12-
# copy of upstream.
8+
# 1. Strip the proprietary enterprise code (enterprise/LICENSE.md forbids
9+
# redistribution without a BerriAI subscription; everything else is MIT,
10+
# which allows republishing). All litellm imports of litellm_enterprise
11+
# are ImportError-guarded, and we never set LITELLM_LICENSE, so nothing
12+
# is lost. This runs even with an empty patch/ dir — republishing the
13+
# unmodified image would otherwise still redistribute enterprise code.
14+
# 2. Apply patch/*.patch onto the installed litellm package. Only litellm/*
15+
# paths are applied — tests/ and ui/ sources in a patch are skipped (the
16+
# image ships prebuilt UI assets, so ui/ source changes are inert anyway).
17+
# 3. Import the proxy server as a smoke test that the image still boots
18+
# without the enterprise code and with the patches applied.
1319
COPY patch/ /tmp/patch/
1420
RUN set -e; \
21+
pip uninstall -y litellm-enterprise; \
22+
rm -rf /app/enterprise; \
23+
cd "$(python -c 'import site; print(site.getsitepackages()[0])')"; \
1524
if ls /tmp/patch/*.patch >/dev/null 2>&1; then \
1625
apk add --no-cache git; \
17-
cd "$(python -c 'import site; print(site.getsitepackages()[0])')"; \
1826
for p in /tmp/patch/*.patch; do \
1927
echo "=== applying $p ==="; \
2028
git apply --verbose --include='litellm/*' "$p"; \
@@ -23,4 +31,6 @@ RUN set -e; \
2331
python -m compileall -q litellm; \
2432
apk del git; \
2533
fi; \
26-
rm -rf /tmp/patch
34+
rm -rf /tmp/patch; \
35+
python -c 'import litellm.proxy.proxy_server' \
36+
&& echo "proxy_server imports OK without enterprise code"

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# litellm-lagoon-base
22

33
Republishes the upstream [LiteLLM](https://github.com/BerriAI/litellm) proxy
4-
images with our pending upstream patches applied — nothing else. With an empty
5-
`patch/` dir the output is a 1-to-1 copy of upstream.
4+
images with our pending upstream patches applied and the proprietary
5+
`enterprise/` code removed — nothing else. LiteLLM is MIT-licensed **except**
6+
the enterprise components, whose license forbids redistribution without a
7+
BerriAI subscription, so the published images contain MIT-licensed code only.
8+
With an empty `patch/` dir the output is a 1-to-1 copy of upstream minus
9+
those enterprise components.
610

711
Two packages, mirroring the upstream image variants, tagged with the upstream
812
release (e.g. `v1.93.0`) plus `latest`:
@@ -14,10 +18,14 @@ release (e.g. `v1.93.0`) plus `latest`:
1418

1519
## How it works
1620

17-
- `Dockerfile` starts `FROM ${LITELLM_IMAGE}:${LITELLM_VERSION}` and applies
21+
- `Dockerfile` starts `FROM ${LITELLM_IMAGE}:${LITELLM_VERSION}`, removes the
22+
enterprise code (`litellm-enterprise` package + `/app/enterprise` — all
23+
litellm imports of it are ImportError-guarded and features are dormant
24+
without `LITELLM_LICENSE`, so nothing functional is lost), and applies
1825
every `patch/*.patch` onto the installed `litellm` site-package with
1926
`git apply --include='litellm/*'` (tests/UI-source paths in a patch are
20-
skipped — the images ship prebuilt UI assets).
27+
skipped — the images ship prebuilt UI assets). A final
28+
`import litellm.proxy.proxy_server` smoke-checks the result.
2129
- `.github/workflows/build.yml` runs once a day, resolves the latest
2230
**stable** (non-prerelease) LiteLLM release, and builds/pushes both variants
2331
if not already published. Pushes to `main` touching `Dockerfile` or `patch/`
@@ -47,7 +55,8 @@ git diff > <this-repo>/patch/0001-litellm-pr31618-budget-threshold-webhook-alert
4755
## When the PR merges upstream
4856

4957
Delete `patch/*.patch` (keep `patch/.gitkeep`) and push. Builds continue and
50-
publish unpatched 1-to-1 copies of upstream — consumers keep working unchanged.
58+
publish unpatched copies of upstream (still enterprise-stripped) — consumers
59+
keep working unchanged.
5160

5261
## Consuming the internal packages
5362

0 commit comments

Comments
 (0)