diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..2bcdfd92b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +models/ diff --git a/.gitignore b/.gitignore index c4bbee8ba..359f7a03d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,10 +25,10 @@ lib/ lib64/ parts/ sdist/ -models + var/ wheels/ -models/ +models/* pip-wheel-metadata/ share/python-wheels/ *.egg-info/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index e049bc166..000000000 --- a/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM ubuntu:latest - -RUN apt-get update && apt-get install -y \ - git \ - python3 \ - pip - - -WORKDIR /app - -COPY . /app - -RUN pip install -r requirements.txt - -EXPOSE 3306 -EXPOSE 8000 - -CMD ["python", "pilot/server/llmserver.py"] -CMD ["python", "pilot/server/webserver.py"] - - diff --git a/Dockerfile-llmserver b/Dockerfile-llmserver new file mode 100644 index 000000000..c36567381 --- /dev/null +++ b/Dockerfile-llmserver @@ -0,0 +1,21 @@ +FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 + +RUN apt-get update && apt-get install -y \ + git \ + python3 \ + pip + + +WORKDIR /app + +COPY . /app + + +# upgrade pip +RUN pip3 install --upgrade pip + +RUN pip install --no-cache-dir -r requirements.txt + +EXPOSE 8000 + +CMD ["python3", "pilot/server/llmserver.py"] diff --git a/Dockerfile-webserver b/Dockerfile-webserver new file mode 100644 index 000000000..bd6aa73dd --- /dev/null +++ b/Dockerfile-webserver @@ -0,0 +1,23 @@ +FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 + +RUN apt-get update && apt-get install -y \ + git \ + python3 \ + pip + + +WORKDIR /app + +COPY . /app + + +# upgrade pip +RUN pip3 install --upgrade pip + +RUN pip install --no-cache-dir -r requirements.txt + +RUN python3 -m spacy download zh_core_web_sm + +EXPOSE 7860 + +CMD ["python3", "pilot/server/webserver.py"] diff --git a/docker-compose.yml b/docker-compose.yml index dca53ef2b..b224e1ac3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,60 @@ version: '3.10' services: - db-gpt: + db: + image: mysql:8.0.33 + environment: + MYSQL_DATABASE: 'db' + MYSQL_USER: 'user' + MYSQL_PASSWORD: 'password' + MYSQL_ROOT_PASSWORD: 'aa123456' + ports: + - 3306:3306 + volumes: + - my-db:/var/lib/mysql + restart: unless-stopped + webserver: build: context: . - dockerfile: Dockerfile - image: db-gpt:latest - container_name: db-gpt + dockerfile: Dockerfile-webserver + environment: + - MODEL_SERVER=http://llmserver:8000 + - LOCAL_DB_HOST=db + - WEB_SERVER_PORT=7860 + volumes: + - ./models:/app/models + - ./plugins:/app/plugins + - data:/app/pilot/data + env_file: + - .env.template + ports: + - 7860:7860 + expose: + - 7860 + restart: unless-stopped + llmserver: + build: + context: . + dockerfile: Dockerfile-llmserver + environment: + - LOCAL_DB_HOST=db + volumes: + - ./models:/app/models + env_file: + - .env.template ports: - 8000:8000 - - 3306:3306 restart: unless-stopped - read-only: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + device_ids: ['1'] + capabilities: [gpu] + + + +volumes: + my-db: + data: