From dae394050e7d30217f0e93b963fe2e590484ee4a Mon Sep 17 00:00:00 2001 From: Amgad Hasan <109704569+AmgadHasan@users.noreply.github.com> Date: Sun, 18 Aug 2024 22:19:18 +0300 Subject: [PATCH] Improve docker deployment configuration (#163) --- api_tokens_sample.yml | 2 ++ docker/.dockerignore | 4 +++- docker/Dockerfile | 24 ++++-------------------- docker/docker-compose.yml | 4 +++- 4 files changed, 12 insertions(+), 22 deletions(-) create mode 100644 api_tokens_sample.yml diff --git a/api_tokens_sample.yml b/api_tokens_sample.yml new file mode 100644 index 0000000..9a0b75f --- /dev/null +++ b/api_tokens_sample.yml @@ -0,0 +1,2 @@ +api_key: # Insert api key here +admin_key: # Insert admin key here \ No newline at end of file diff --git a/docker/.dockerignore b/docker/.dockerignore index f223bdc..ae8a12c 100644 --- a/docker/.dockerignore +++ b/docker/.dockerignore @@ -1,4 +1,6 @@ models/ loras/ .ruff_cache/ -**/__pycache__/ \ No newline at end of file +**/__pycache__/ +config.yml +api_tokens.yml \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index eece0fd..0b709b5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,12 +1,5 @@ # Use an official CUDA runtime with Ubuntu as a parent image -FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04 - -ARG GIT_REPO=https://github.com/theroyallab/tabbyAPI -ARG DO_PULL=true -ENV DO_PULL $DO_PULL - -# Set the working directory in the container -WORKDIR /app +FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ @@ -15,20 +8,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ python3.11 \ python3-pip \ - git \ && rm -rf /var/lib/apt/lists/* -# Update repo -RUN if [ ${DO_PULL} ]; then \ - git init && \ - git remote add origin $GIT_REPO && \ - git fetch origin && \ - git pull origin main && \ - echo "Pull finished"; fi - # Upgrade pip RUN pip3 install --no-cache-dir --upgrade pip +# Set the working directory in the container +WORKDIR /app + # Get requirements COPY pyproject.toml . @@ -38,9 +25,6 @@ RUN pip3 install --no-cache-dir .[cu121] # Copy the current directory contents into the container COPY . . -# Create a config.yml -COPY config_sample.yml config.yml - # Make port 5000 available to the world outside this container EXPOSE 5000 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c337b20..90787da 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -12,7 +12,9 @@ services: - NAME=TabbyAPI - NVIDIA_VISIBLE_DEVICES=all volumes: - - ./models:/app/models + # - /path/to/models:/app/models # Change me + # - /path/to/config.yml:/app/config.yml # Change me + # - /path/to/api_tokens.yml:/app/api_tokens.yml # Change me deploy: resources: reservations: