Add basic docker support

This commit is contained in:
city_unit 2023-11-19 00:01:17 -05:00
parent 6b9af58cc1
commit 99cf0b6d7b
2 changed files with 50 additions and 0 deletions

37
Docker Normal file
View file

@ -0,0 +1,37 @@
# Use an official CUDA runtime with Ubuntu as a parent image
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04
# Install Python and pip
RUN apt-get update && apt-get install -y \
python3.11 \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Alias python and pip to python3 and pip3
#RUN ln -s /usr/bin/python3 /usr/bin/python
# Set the working directory in the container
WORKDIR /usr/src/app
# Copy the current directory contents into the container at /usr/src/app
COPY . .
# Install torch with CUDA support and exllamav2
RUN pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
RUN pip install exllamav2
# Install any other needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the sample config file to the main config
RUN cp config_sample.yml config.yml
# Make port 5000 available to the world outside this container
EXPOSE 5000
# Define environment variable
ENV NAME World
# Run main.py when the container launches
CMD ["python3", "main.py"]

13
docker-compose.yml Normal file
View file

@ -0,0 +1,13 @@
version: '3.8'
services:
tabbyapi:
build: .
ports:
- "5000:5000"
runtime: nvidia
environment:
- NAME=TabbyAPI
- NVIDIA_VISIBLE_DEVICES=all
# volumes:
# - /path/to/models:/usr/src/app/models
# - /path/to/config:/usr/src/app/config.yml