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