add docker start introduction & add GUI support for docker

This commit is contained in:
thinkwee 2023-10-26 11:31:40 +08:00
parent 7c107f81f4
commit dee6db433e
4 changed files with 48 additions and 1 deletions

View File

@ -7,6 +7,9 @@ WORKDIR /app
# Copy the current directory contents into the container at /app
COPY . /app
# Install necessary libraries for GUI support
RUN apt-get update && apt-get install -y python3-tk x11-apps
# Install the project dependencies
RUN pip install --no-cache-dir -r requirements.txt
@ -18,4 +21,4 @@ ENV OPENAI_API_KEY=your_OpenAI_API_key
EXPOSE 8000
# Set an entry point that runs a shell for interactive mode
ENTRYPOINT ["/bin/bash"]
ENTRYPOINT ["/bin/bash"]

View File

@ -52,6 +52,8 @@ https://github.com/OpenBMB/ChatDev/assets/11889052/80d01d2f-677b-4399-ad8b-f7af9
## ⚡️ Quickstart
### 🖥️ Quickstart with terminal
To get started, follow these steps:
1. **Clone the GitHub Repository:** Begin by cloning the repository using the command:
@ -105,6 +107,9 @@ To get started, follow these steps:
cd WareHouse/project_name_DefaultOrganization_timestamp
python main.py
```
### 🐳 Quickstart with Docker
- We thank [ManindraDeMel](https://github.com/ManindraDeMel) for providing Docker support. Please see [Docker guide](wiki.md#docker-start).
## ✨️ Advanced Skills

BIN
misc/xquartz.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

39
wiki.md
View File

@ -84,6 +84,45 @@ then go to [Local Demo Website](http://127.0.0.1:8000/) to see an online visuali
![Replay](misc/replay.gif)
## Docker Start
- You can use docker for a quick and safe use of ChatDev. You will need some extra steps to allow executing GUI program in docker since ChatDev often create software with GUI and execute them in the Test Phase.
### Install Docker
- Please refer to the [Docker Official Website](https://www.docker.com/get-started/) for installing Docker.
### Prepare GUI connection between Host and Docker
- Take macOS for example,
- install socat and xquartz, you may need to restart the computer after installing the xquartz
```commandline
brew install socat xquartz
```
- open xquartz and go into the settings, allow connections from network clients
- ![xquartz](misc/xquartz.jpg)
- run following command on the host computer and keep it.
```commandline
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
```
- run following command on the host computer to check your ip (the address of inet).
```commandline
ifconfig en0
```
### Build Docker images
- under the ChatDev folder, run
```commandline
docker build -t chatdev:latest .
```
it will generate a 400MB+ docker image named chatdev.
### Run Docker
- run following command to create and go into a container
```commandline
docker run -it -p 8000:8000 -e OPENAI_API_KEY=YOUR_OPENAI_KEY -e DISPLAY=YOUR_IP:0 chatdev:latest
```
⚠️ You need to replace ``YOUR_OPENAI_KEY`` with your key and replace ``YOUR_IP`` with your inet address.
- Then you can just playing ChatDev with ``python3 run.py``
- You can run ``python3 online_log/app.py &`` first to start a background program so that you can use online log with a WebUI.
## Customization
- You can customize your company in three kinds of granularity: