Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +48 -4
Dockerfile
CHANGED
|
@@ -1,11 +1,55 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
| 7 |
COPY . .
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
| 1 |
+
# Base image for building
|
| 2 |
+
ARG LITELLM_BUILD_IMAGE=python:3.9
|
| 3 |
|
| 4 |
+
# Runtime image
|
| 5 |
+
ARG LITELLM_RUNTIME_IMAGE=python:3.9-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 the package
|
| 24 |
+
RUN rm -rf dist/* && python -m build
|
| 25 |
+
|
| 26 |
+
# There should be only one wheel file now, assume the build only creates one
|
| 27 |
+
RUN ls -1 dist/*.whl | head -1
|
| 28 |
+
|
| 29 |
+
# Install the package
|
| 30 |
+
RUN pip install dist/*.whl
|
| 31 |
+
|
| 32 |
+
# install dependencies as wheels
|
| 33 |
+
RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt
|
| 34 |
+
|
| 35 |
+
# Runtime stage
|
| 36 |
+
FROM $LITELLM_RUNTIME_IMAGE as runtime
|
| 37 |
+
|
| 38 |
+
WORKDIR /app
|
| 39 |
+
# Copy the current directory contents into the container at /app
|
| 40 |
+
COPY . .
|
| 41 |
+
RUN ls -la /app
|
| 42 |
+
|
| 43 |
+
# Copy the built wheel from the builder stage to the runtime stage; assumes only one wheel file is present
|
| 44 |
+
COPY --from=builder /app/dist/*.whl .
|
| 45 |
+
COPY --from=builder /wheels/ /wheels/
|
| 46 |
+
|
| 47 |
+
# Install the built wheel using pip; again using a wildcard if it's the only file
|
| 48 |
+
RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl && rm -rf /wheels
|
| 49 |
+
|
| 50 |
+
RUN chmod +x entrypoint.sh
|
| 51 |
+
|
| 52 |
+
EXPOSE 4000/tcp
|
| 53 |
|
| 54 |
+
ENTRYPOINT ["litellm"]
|
| 55 |
+
CMD ["--port", "4000", "--config", "./proxy_server_config.yaml", "--detailed_debug", "--run_gunicorn"]
|