From a9c69cf5c21cc410004c6c5f4c2d8b9b5a046aaa Mon Sep 17 00:00:00 2001 From: P0sitive Date: Fri, 7 Jul 2023 13:03:35 +0800 Subject: [PATCH 1/7] Initial commit --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..732d11cc1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +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 pip mirror and 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 + +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 &&\ + pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ &&\ + pip install -r requirements.txt &&\ + python setup.py install + From 954f85849e5675fd9b1d6eab91cc86d62231a929 Mon Sep 17 00:00:00 2001 From: P0sitive Date: Fri, 7 Jul 2023 13:03:51 +0800 Subject: [PATCH 2/7] add docker descriptions --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index c51839263..576806f66 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,22 @@ # 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:///v1" | export OPENAI_API_BASE="https:///v1" | +## Docker Setup + +You can also use docker to setup MetaGPT. +```bash +cd metagpt +docker build --network host -t metagpt: . +``` +There are some changes of mirrors in the dockerfile, for users outside mainland China, feel free to modify or delete them :) + +To run the docker image, you can use the following command. +```bash +docker run docker run -it -v :/app/metagpt/config -v :/app/metagpt/workspace metagpt: +``` +This command mounts the config folder and workspace folder in the host machine, and you should use absolute directory of these folders. The `command` is what you want to run, you can set it as `/bin/bash -c "cd metagpt && python startup.py "Write helloworld in python""` or just `/bin/bash` for interactive terminal. + + ## Tutorial: Initiating a startup ```shell From df8d1124c68b62bb98c71b6071abf5efe6293dba Mon Sep 17 00:00:00 2001 From: sablin39 <1020030829@qq.com> Date: Fri, 7 Jul 2023 13:09:12 +0800 Subject: [PATCH 3/7] add docker descriptions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 576806f66..aa273ac88 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ ## Docker Setup ```bash docker run docker run -it -v :/app/metagpt/config -v :/app/metagpt/workspace metagpt: ``` -This command mounts the config folder and workspace folder in the host machine, and you should use absolute directory of these folders. The `command` is what you want to run, you can set it as `/bin/bash -c "cd metagpt && python startup.py "Write helloworld in python""` or just `/bin/bash` for interactive terminal. +This command mounts the config folder and workspace folder in the host machine, so the container can use the same comfiguration and store the works in the host machine. You should use absolute directory of these folders. The `command` is what you want to run, you can set it as `/bin/bash -c "cd metagpt && python startup.py "Write helloworld in python""` or just `/bin/bash` for interactive terminal. ## Tutorial: Initiating a startup From b41d9c25f0ff0ddee1a99b5ddba3a50776d99376 Mon Sep 17 00:00:00 2001 From: sablin39 <1020030829@qq.com> Date: Sun, 9 Jul 2023 17:13:59 +0800 Subject: [PATCH 4/7] Add cache removal commands --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 732d11cc1..58427dc0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ 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 pip mirror and apt mirror setup + #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 &&\ @@ -12,12 +12,15 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list &&\ WORKDIR /app -RUN npm config set registry https://registry.npm.taobao.org &&\ - npm install -g @mermaid-js/mermaid-cli &&\ +RUN npm install -g @mermaid-js/mermaid-cli &&\ git clone https://github.com/geekan/metagpt RUN cd metagpt &&\ mkdir workspace &&\ + #This sets the pip mirror, you can delete it if you need to. pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ &&\ - pip install -r requirements.txt &&\ + pip install -r requirements.txt --no-cache-dir &&\ python setup.py install +RUN pip cache purge &&\ + apt autoclean + From ca97b7998e2a00eaffdf3622f0934136f4799b51 Mon Sep 17 00:00:00 2001 From: sablin39 <1020030829@qq.com> Date: Sun, 9 Jul 2023 17:14:14 +0800 Subject: [PATCH 5/7] Fixed some typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index aa273ac88..26efcb517 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ ## Docker Setup To run the docker image, you can use the following command. ```bash -docker run docker run -it -v :/app/metagpt/config -v :/app/metagpt/workspace metagpt: +docker run -it -v :/app/metagpt/config -v :/app/metagpt/workspace metagpt: ``` This command mounts the config folder and workspace folder in the host machine, so the container can use the same comfiguration and store the works in the host machine. You should use absolute directory of these folders. The `command` is what you want to run, you can set it as `/bin/bash -c "cd metagpt && python startup.py "Write helloworld in python""` or just `/bin/bash` for interactive terminal. From 6e6bc93853b61f6fba329c05d4c91e180f5ab43b Mon Sep 17 00:00:00 2001 From: sablin39 <1020030829@qq.com> Date: Sun, 9 Jul 2023 18:06:36 +0800 Subject: [PATCH 6/7] add cahce removal commands --- Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 58427dc0d..29f664e97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ 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 + #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 &&\ @@ -11,12 +11,13 @@ RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list &&\ WORKDIR /app - -RUN npm install -g @mermaid-js/mermaid-cli &&\ + #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, you can delete it if you need to. + #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 @@ -24,3 +25,4 @@ RUN cd metagpt &&\ RUN pip cache purge &&\ apt autoclean + From 72ee1a7fbfb40c3bec7dbaf95d64f31ced3336e5 Mon Sep 17 00:00:00 2001 From: sablin39 <1020030829@qq.com> Date: Sun, 9 Jul 2023 18:09:11 +0800 Subject: [PATCH 7/7] Fixed typos and add dockerhub links --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 26efcb517..d433ff72b 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,13 @@ ## Docker Setup ``` 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:`. + To run the docker image, you can use the following command. ```bash docker run -it -v :/app/metagpt/config -v :/app/metagpt/workspace metagpt: ``` -This command mounts the config folder and workspace folder in the host machine, so the container can use the same comfiguration and store the works in the host machine. You should use absolute directory of these folders. The `command` is what you want to run, you can set it as `/bin/bash -c "cd metagpt && python startup.py "Write helloworld in python""` or just `/bin/bash` for interactive terminal. +This command mounts the `config` and `workspace` folder in the host machine. You should use absolute directory of these folders. ## Tutorial: Initiating a startup