Merge pull request #16 from sablin39/main

Adding a Dockerfile for docker implementation
This commit is contained in:
geekan 2023-07-09 21:47:59 +08:00 committed by GitHub
commit 37902e4e71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 0 deletions

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
FROM python:3.9.17-slim-bullseye
#Special gifts for mainland China users :)
#Change to your own preferenced mirrors if you wish, just uncomment them is fine too.
#Below is apt mirror setup.
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list &&\
apt update &&\
apt install -y git curl wget build-essential gcc clang g++ make &&\
curl -sL https://deb.nodesource.com/setup_19.x | bash - &&\
apt install -y nodejs
WORKDIR /app
#This sets npm mirror url.
RUN npm config set registry https://registry.npm.taobao.org &&\
npm install -g @mermaid-js/mermaid-cli &&\
git clone https://github.com/geekan/metagpt
RUN cd metagpt &&\
mkdir workspace &&\
#This sets the pip mirror url.
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ &&\
pip install -r requirements.txt --no-cache-dir &&\
python setup.py install
RUN pip cache purge &&\
apt autoclean

View file

@ -66,6 +66,24 @@ # Copy the configuration file and make the necessary modifications.
| OPENAI_API_KEY # Replace with your own key | OPENAI_API_KEY: "sk-..." | export OPENAI_API_KEY="sk-..." |
| OPENAI_API_BASE # Optional | OPENAI_API_BASE: "https://<YOUR_SITE>/v1" | export OPENAI_API_BASE="https://<YOUR_SITE>/v1" |
## Docker Setup
You can also use docker to setup MetaGPT.
```bash
cd metagpt
docker build --network host -t metagpt:<version> .
```
There are some changes of mirrors in the dockerfile, for users outside mainland China, feel free to modify or delete them :)
You can also pull the image from dockerhub via `docker pull sablin39/metagpt:<TAG>`.
To run the docker image, you can use the following command.
```bash
docker run -it -v <MetaGPT-config-dir>:/app/metagpt/config -v <Workspace-dir>:/app/metagpt/workspace metagpt:<version> <command>
```
This command mounts the `config` and `workspace` folder in the host machine. You should use absolute directory of these folders.
## Tutorial: Initiating a startup
```shell