diff --git a/Dockerfile b/Dockerfile index 66fac75a..3a9df3c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md index 86c692ad..360e6392 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/misc/xquartz.jpg b/misc/xquartz.jpg new file mode 100644 index 00000000..7af24d0d Binary files /dev/null and b/misc/xquartz.jpg differ diff --git a/wiki.md b/wiki.md index d3f5ea29..5512a15e 100644 --- a/wiki.md +++ b/wiki.md @@ -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: