mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-16 07:24:05 +00:00
Fixed up docker-compose (#267)
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 ```
This commit is contained in:
commit
2f3a06011a
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
models/
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -25,10 +25,10 @@ lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
models
|
||||
|
||||
var/
|
||||
wheels/
|
||||
models/
|
||||
models/*
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
|
21
Dockerfile
21
Dockerfile
@ -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"]
|
||||
|
||||
|
21
Dockerfile-llmserver
Normal file
21
Dockerfile-llmserver
Normal file
@ -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
Dockerfile-webserver
Normal file
23
Dockerfile-webserver
Normal file
@ -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"]
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user