(fix) clean up root repo - move entrypoint.sh and build_admin_ui to /docker (#6110)

* fix move docker files to docker folders

* move check file length

* fix docker hub deploy

* fix clean up root

* fix circle ci config
This commit is contained in:
Ishaan Jaff 2024-10-08 11:34:43 +05:30 committed by GitHub
parent cc960da4b6
commit d1760b1b04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 22 additions and 22 deletions

View file

@ -31,8 +31,8 @@ RUN rm -rf /app/litellm/proxy/_experimental/out/* && \
# Switch back to the main app directory
WORKDIR /app
# Make sure your entrypoint.sh is executable
RUN chmod +x entrypoint.sh
# Make sure your docker/entrypoint.sh is executable
RUN chmod +x docker/entrypoint.sh
# Expose the necessary port
EXPOSE 4000/tcp

View file

@ -21,7 +21,7 @@ RUN pip install --upgrade pip && \
COPY . .
# Build Admin UI
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
RUN chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
# Build the package
RUN rm -rf dist/* && python -m build
@ -62,11 +62,11 @@ RUN pip uninstall PyJWT -y
RUN pip install PyJWT==2.9.0 --no-cache-dir
# Build Admin UI
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
RUN chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
# Generate prisma client
RUN prisma generate
RUN chmod +x entrypoint.sh
RUN chmod +x docker/entrypoint.sh
EXPOSE 4000/tcp

View file

@ -21,7 +21,7 @@ RUN pip install --upgrade pip && \
COPY . .
# Build Admin UI
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
RUN chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
# Build the package
RUN rm -rf dist/* && python -m build
@ -62,7 +62,7 @@ RUN pip uninstall PyJWT -y
RUN pip install PyJWT==2.9.0 --no-cache-dir
# Build Admin UI
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
RUN chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
# Generate prisma client
ENV PRISMA_BINARY_CACHE_DIR=/app/prisma
@ -71,7 +71,7 @@ RUN chmod -R 777 /.cache
RUN pip install nodejs-bin
RUN pip install prisma
RUN prisma generate
RUN chmod +x entrypoint.sh
RUN chmod +x docker/entrypoint.sh
EXPOSE 4000/tcp

62
docker/build_admin_ui.sh Executable file
View file

@ -0,0 +1,62 @@
#!/bin/bash
# # try except this script
# set -e
# print current dir
echo
pwd
# only run this step for litellm enterprise, we run this if enterprise/enterprise_ui/_enterprise.json exists
if [ ! -f "enterprise/enterprise_ui/enterprise_colors.json" ]; then
echo "Admin UI - using default LiteLLM UI"
exit 0
fi
echo "Building Custom Admin UI..."
# Install dependencies
# Check if we are on macOS
if [[ "$(uname)" == "Darwin" ]]; then
# Install dependencies using Homebrew
if ! command -v brew &> /dev/null; then
echo "Error: Homebrew not found. Please install Homebrew and try again."
exit 1
fi
brew update
brew install curl
else
# Assume Linux, try using apt-get
if command -v apt-get &> /dev/null; then
apt-get update
apt-get install -y curl
elif command -v apk &> /dev/null; then
# Try using apk if apt-get is not available
apk update
apk add curl
else
echo "Error: Unsupported package manager. Cannot install dependencies."
exit 1
fi
fi
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.nvm/nvm.sh
nvm install v18.17.0
nvm use v18.17.0
npm install -g npm
# copy _enterprise.json from this directory to /ui/litellm-dashboard, and rename it to ui_colors.json
cp enterprise/enterprise_ui/enterprise_colors.json ui/litellm-dashboard/ui_colors.json
# cd in to /ui/litellm-dashboard
cd ui/litellm-dashboard
# ensure have access to build_ui.sh
chmod +x ./build_ui.sh
# run ./build_ui.sh
./build_ui.sh
# return to root directory
cd ../..

13
docker/entrypoint.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
echo $(pwd)
# Run the Python migration script
python3 litellm/proxy/prisma_migration.py
# Check if the Python script executed successfully
if [ $? -eq 0 ]; then
echo "Migration script ran successfully!"
else
echo "Migration script failed!"
exit 1
fi