Skip to content

Commit 143bbe3

Browse files
committed
fix dockerfile
1 parent a4f9ba4 commit 143bbe3

File tree

3 files changed

+81
-10
lines changed

3 files changed

+81
-10
lines changed

Dockerfile

-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ COPY --from=builder /wheels/ /wheels/
6262
RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl && rm -rf /wheels
6363

6464
# Generate prisma client
65-
ENV PRISMA_BINARY_CACHE_DIR=/app/prisma
66-
RUN mkdir -p /.cache
67-
RUN chmod -R 777 /.cache
68-
RUN pip install nodejs-bin
69-
RUN pip install prisma
7065
RUN prisma generate
7166
RUN chmod +x entrypoint.sh
7267

Dockerfile.database

-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ RUN pip install PyJWT --no-cache-dir
6262
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
6363

6464
# Generate prisma client
65-
ENV PRISMA_BINARY_CACHE_DIR=/app/prisma
66-
RUN mkdir -p /.cache
67-
RUN chmod -R 777 /.cache
68-
RUN pip install nodejs-bin
69-
RUN pip install prisma
7065
RUN prisma generate
7166
RUN chmod +x entrypoint.sh
7267

Dockerfile.non_root

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Base image for building
2+
ARG LITELLM_BUILD_IMAGE=python:3.11.8-slim
3+
4+
# Runtime image
5+
ARG LITELLM_RUNTIME_IMAGE=python:3.11.8-slim
6+
# Builder stage
7+
FROM $LITELLM_BUILD_IMAGE as builder
8+
9+
# Set the working directory to /app
10+
WORKDIR /app
11+
12+
# Install build dependencies
13+
RUN apt-get clean && apt-get update && \
14+
apt-get install -y gcc python3-dev && \
15+
rm -rf /var/lib/apt/lists/*
16+
17+
RUN pip install --upgrade pip && \
18+
pip install build
19+
20+
# Copy the current directory contents into the container at /app
21+
COPY . .
22+
23+
# Build Admin UI
24+
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
25+
26+
# Build the package
27+
RUN rm -rf dist/* && python -m build
28+
29+
# There should be only one wheel file now, assume the build only creates one
30+
RUN ls -1 dist/*.whl | head -1
31+
32+
# Install the package
33+
RUN pip install dist/*.whl
34+
35+
# install dependencies as wheels
36+
RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt
37+
38+
# Runtime stage
39+
FROM $LITELLM_RUNTIME_IMAGE as runtime
40+
41+
WORKDIR /app
42+
# Copy the current directory contents into the container at /app
43+
COPY . .
44+
RUN ls -la /app
45+
46+
# Copy the built wheel from the builder stage to the runtime stage; assumes only one wheel file is present
47+
COPY --from=builder /app/dist/*.whl .
48+
COPY --from=builder /wheels/ /wheels/
49+
50+
# Install the built wheel using pip; again using a wildcard if it's the only file
51+
RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl && rm -rf /wheels
52+
53+
# install semantic-cache [Experimental]- we need this here and not in requirements.txt because redisvl pins to pydantic 1.0
54+
RUN pip install redisvl==0.0.7 --no-deps
55+
56+
# ensure pyjwt is used, not jwt
57+
RUN pip uninstall jwt -y
58+
RUN pip uninstall PyJWT -y
59+
RUN pip install PyJWT --no-cache-dir
60+
61+
# Build Admin UI
62+
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
63+
64+
# Generate prisma client
65+
ENV PRISMA_BINARY_CACHE_DIR=/app/prisma
66+
RUN mkdir -p /.cache
67+
RUN chmod -R 777 /.cache
68+
RUN pip install nodejs-bin
69+
RUN pip install prisma
70+
RUN prisma generate
71+
RUN chmod +x entrypoint.sh
72+
73+
EXPOSE 4000/tcp
74+
75+
# # Set your entrypoint and command
76+
77+
ENTRYPOINT ["litellm"]
78+
79+
# Append "--detailed_debug" to the end of CMD to view detailed debug logs
80+
# CMD ["--port", "4000", "--detailed_debug"]
81+
CMD ["--port", "4000"]

0 commit comments

Comments
 (0)