|
|
|
ARG LITELLM_BUILD_IMAGE=python:3.13.1-slim |
|
|
|
|
|
ARG LITELLM_RUNTIME_IMAGE=python:3.13.1-slim |
|
|
|
FROM $LITELLM_BUILD_IMAGE AS builder |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
|
|
|
|
|
RUN apt-get clean && apt-get update && \ |
|
apt-get install -y gcc python3-dev && \ |
|
rm -rf /var/lib/apt/lists/* |
|
|
|
RUN pip install --no-cache-dir --upgrade pip && \ |
|
pip install --no-cache-dir build |
|
|
|
|
|
COPY . . |
|
|
|
|
|
RUN chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh |
|
|
|
|
|
RUN rm -rf dist/* && python -m build |
|
|
|
|
|
RUN ls -1 dist/*.whl | head -1 |
|
|
|
|
|
RUN pip install dist/*.whl |
|
|
|
|
|
RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt |
|
|
|
|
|
FROM $LITELLM_RUNTIME_IMAGE AS runtime |
|
|
|
|
|
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* |
|
|
|
WORKDIR /app |
|
|
|
COPY . . |
|
RUN ls -la /app |
|
|
|
|
|
COPY --from=builder /app/dist/*.whl . |
|
COPY --from=builder /wheels/ /wheels/ |
|
|
|
|
|
RUN pip install *.whl /wheels/* --no-index --find-links=/wheels/ && rm -f *.whl && rm -rf /wheels |
|
|
|
|
|
|
|
RUN pip install redisvl==0.0.7 --no-deps --no-cache-dir && \ |
|
pip uninstall jwt -y && \ |
|
pip uninstall PyJWT -y && \ |
|
pip install PyJWT==2.9.0 --no-cache-dir |
|
|
|
|
|
RUN chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh |
|
|
|
|
|
|
|
ENV PRISMA_BINARY_CACHE_DIR=/nonexistent |
|
|
|
RUN pip install --no-cache-dir nodejs-bin prisma |
|
|
|
|
|
RUN mkdir -p /nonexistent && \ |
|
chown -R nobody:nogroup /app && \ |
|
chown -R nobody:nogroup /nonexistent && \ |
|
chown -R nobody:nogroup /usr/local/lib/python3.13/site-packages/prisma/ |
|
|
|
RUN chmod +x docker/entrypoint.sh |
|
RUN chmod +x docker/prod_entrypoint.sh |
|
|
|
|
|
USER nobody |
|
|
|
RUN prisma generate |
|
|
|
|
|
EXPOSE 4000/tcp |
|
|
|
|
|
ENTRYPOINT ["docker/prod_entrypoint.sh"] |
|
|
|
|
|
|
|
CMD ["--port", "4000"] |
|
|