mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-01 03:46:23 +02:00
Optimize Dockerfile and README
This commit is contained in:
parent
37902e4e71
commit
62a1fcdf69
2 changed files with 51 additions and 31 deletions
52
README.md
52
README.md
|
|
@ -36,7 +36,7 @@ ## Examples (fully generated by GPT-4)
|
|||
It requires around **$0.2** (GPT-4 api's costs) to generate one example with analysis and design, around **$2.0** to a full project.
|
||||
|
||||
## Installation
|
||||
|
||||
### Traditional Installation
|
||||
```bash
|
||||
# Step 1: Ensure that NPM is installed on your system. Then install mermaid-js.
|
||||
npm --version
|
||||
|
|
@ -51,6 +51,38 @@ # Step 3: Clone the repository to your local machine, and install it.
|
|||
python setup.py install
|
||||
```
|
||||
|
||||
### Installation by Docker
|
||||
```bash
|
||||
# Step 1: Download metagpt official image and prepare config.yaml
|
||||
docker pull metagpt/metagpt:v0.1
|
||||
mkdir -p /opt/metagpt/config && docker run --rm metagpt/metagpt:v0.1 cat /app/metagpt/config/config.yaml > /opt/metagpt/config/config.yaml
|
||||
vim /opt/metagpt/config/config.yaml # Change the config
|
||||
|
||||
# Step 2: Run metagpt image
|
||||
docker run --name metagpt -d \
|
||||
-v /opt/metagpt/config:/app/metagpt/config \
|
||||
-v /opt/metagpt/workspace:/app/metagpt/workspace \
|
||||
metagpt/metagpt:v0.1
|
||||
|
||||
# Step 3: Access the metagpt container
|
||||
docker exec -it metagpt /bin/bash
|
||||
|
||||
# Step 4: Play in the container
|
||||
cd /app/metagpt
|
||||
python startup.py "Write a cli snake game"
|
||||
```
|
||||
|
||||
The command `docker run ...` do the following things:
|
||||
- Start metagpt container with default command `tail -f /dev/null`
|
||||
- Map host directory `/opt/metagtp/config` to container directory `/app/metagpt/config`
|
||||
- Map host directory `/opt/metagpt/workspace` to container directory `/app/metagpt/workspace`
|
||||
|
||||
### Build image by yourself
|
||||
```bash
|
||||
# You can also build metagpt image by yourself.
|
||||
cd metagpt && docker build --network host -t metagpt:v0.1 .
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
- Configure your `OPENAI_API_KEY` in any of `config/key.yaml / config/config.yaml / env`
|
||||
|
|
@ -66,24 +98,6 @@ # 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue