forked from phoenix/litellm-mirror
multistage docker build
This commit is contained in:
parent
69a4497550
commit
15057d717a
1 changed files with 28 additions and 7 deletions
35
Dockerfile
35
Dockerfile
|
@ -1,8 +1,8 @@
|
|||
# Base image
|
||||
ARG LITELLM_BASE_IMAGE=python:3.9-slim
|
||||
ARG LITELLM_BASE_IMAGE=python:3.9
|
||||
|
||||
# allow users to specify, else use python 3.9-slim
|
||||
FROM $LITELLM_BASE_IMAGE
|
||||
# allow users to specify, else use python 3.9
|
||||
FROM $LITELLM_BASE_IMAGE as builder
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /app
|
||||
|
@ -13,16 +13,37 @@ RUN apt-get update && \
|
|||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY . /app
|
||||
COPY requirements.txt .
|
||||
|
||||
# Make a virtualenv that we can copy across multistage builds
|
||||
ENV VIRTUAL_ENV=/venv
|
||||
RUN python -m venv $VIRTUAL_ENV
|
||||
# "Activate" the virtualenv
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
RUN pip wheel --no-cache-dir --wheel-dir=wheels -r requirements.txt
|
||||
RUN pip install --no-cache-dir --find-links=wheels -r requirements.txt
|
||||
RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
|
||||
###############################################################################
|
||||
# Runtime image
|
||||
ARG LITELLM_RUNTIME_IMAGE=python:3.9-slim
|
||||
|
||||
FROM $LITELLM_RUNTIME_IMAGE as runtime
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the current directory contents into the container at /app
|
||||
COPY . .
|
||||
|
||||
# "Activate" the virtualenv
|
||||
ENV VIRTUAL_ENV=/venv
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
COPY --from=builder /venv /venv
|
||||
|
||||
EXPOSE 4000/tcp
|
||||
|
||||
# Start the litellm proxy, using the `litellm` cli command https://docs.litellm.ai/docs/simple_proxy
|
||||
|
||||
# Start the litellm proxy with default options
|
||||
CMD ["--port", "4000"]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue