Skip to content

Commit

Permalink
Fixed up docker-compose (#267)
Browse files Browse the repository at this point in the history
You can't have two CMD statements in one Dockerfile. Each service should
have it's own container so I split webserver and llmserver into two
containers.

```
docker compose build
docker compose up
```
  • Loading branch information
csunny authored Jun 22, 2023
2 parents 879f6ae + 7283dcd commit 0558a8b
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 29 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
models/
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ lib/
lib64/
parts/
sdist/
models

var/
wheels/
models/
models/*
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
Expand Down
21 changes: 0 additions & 21 deletions Dockerfile

This file was deleted.

21 changes: 21 additions & 0 deletions Dockerfile-llmserver
Original file line number Diff line number Diff line change
@@ -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"]
23 changes: 23 additions & 0 deletions Dockerfile-webserver
Original file line number Diff line number Diff line change
@@ -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"]
58 changes: 52 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit 0558a8b

Please sign in to comment.