Polluelo commited on
Commit
503ebea
1 Parent(s): 9f25714

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +74 -0
Dockerfile ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ # install semantic-cache [Experimental]- we need this here and not in requirements.txt because redisvl pins to pydantic 1.0
39
+ RUN pip install redisvl==0.0.7 --no-deps
40
+
41
+ # ensure pyjwt is used, not jwt
42
+ RUN pip uninstall jwt -y
43
+ RUN pip uninstall PyJWT -y
44
+ RUN pip install PyJWT --no-cache-dir
45
+
46
+ # Build Admin UI
47
+ RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
48
+
49
+ # Runtime stage
50
+ FROM $LITELLM_RUNTIME_IMAGE as runtime
51
+
52
+ WORKDIR /app
53
+ # Copy the current directory contents into the container at /app
54
+ COPY . .
55
+ RUN ls -la /app
56
+
57
+ # Copy the built wheel from the builder stage to the runtime stage; assumes only one wheel file is present
58
+ COPY --from=builder /app/dist/*.whl .
59
+ COPY --from=builder /wheels/ /wheels/
60
+
61
+ # Install the built wheel using pip; again using a wildcard if it's the only file
62
+ RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl && rm -rf /wheels
63
+
64
+ # Generate prisma client
65
+ RUN prisma generate
66
+ RUN chmod +x entrypoint.sh
67
+
68
+ EXPOSE 4000/tcp
69
+
70
+ ENTRYPOINT ["litellm"]
71
+
72
+ # Append "--detailed_debug" to the end of CMD to view detailed debug logs
73
+ # CMD ["--port", "4000", "--config", "./proxy_server_config.yaml"]
74
+ CMD ["--port", "4000", "--config", "./proxy_server_config.yaml"]