Improve docker deployment configuration (#163)

This commit is contained in:
Amgad Hasan 2024-08-18 22:19:18 +03:00 committed by GitHub
parent a51acb9db4
commit dae394050e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 22 deletions

2
api_tokens_sample.yml Normal file
View file

@ -0,0 +1,2 @@
api_key: # Insert api key here
admin_key: # Insert admin key here

View file

@ -2,3 +2,5 @@ models/
loras/
.ruff_cache/
**/__pycache__/
config.yml
api_tokens.yml

View file

@ -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

View file

@ -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: