mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-28 02:23:52 +02:00
Merge pull request #43 from voidking/pr
#35 bugfix: Error: Failed to launch the browser process
This commit is contained in:
commit
fdd68a6caa
2 changed files with 37 additions and 14 deletions
24
Dockerfile
24
Dockerfile
|
|
@ -1,4 +1,4 @@
|
|||
# This Dockerfile is friendly to users in Chinese Mainland :)
|
||||
# This Dockerfile is friendly to users in Chinese Mainland :)
|
||||
# For users outside mainland China, feel free to modify or delete them :)
|
||||
|
||||
# Use a base image with Python 3.9.17 slim version (Bullseye)
|
||||
|
|
@ -7,15 +7,20 @@ FROM python:3.9.17-slim-bullseye
|
|||
# Install Debian software needed by MetaGPT
|
||||
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 &&\
|
||||
apt install -y git curl wget build-essential gcc clang g++ make gnupg &&\
|
||||
curl -sL https://deb.nodesource.com/setup_19.x | bash - &&\
|
||||
apt install -y nodejs &&\
|
||||
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&\
|
||||
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' &&\
|
||||
apt-get update &&\
|
||||
apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends &&\
|
||||
apt-get clean
|
||||
|
||||
# Set the working directory to /app
|
||||
WORKDIR /app
|
||||
|
||||
# Install Mermaid CLI globally and clone the MetaGPT repository
|
||||
#ENV PUPPETEER_SKIP_DOWNLOAD='true'
|
||||
RUN npm config set registry https://registry.npm.taobao.org &&\
|
||||
npm install -g @mermaid-js/mermaid-cli &&\
|
||||
npm cache clean --force &&\
|
||||
|
|
@ -29,6 +34,17 @@ RUN cd metagpt &&\
|
|||
pip cache purge &&\
|
||||
python setup.py install
|
||||
|
||||
# Running with an infinite loop using the tail command
|
||||
CMD ["sh", "-c", "tail -f /dev/null"]
|
||||
# Add metagpt user so we don't need --no-sandbox when use puppeteer
|
||||
RUN useradd -m metagpt -s /bin/bash &&\
|
||||
chown metagpt -R /app/metagpt &&\
|
||||
cp -r /root/.cache /home/metagpt/ &&\
|
||||
chown metagpt -R /home/metagpt/.cache &&\
|
||||
chrome_sandbox=$(find /root/.cache/puppeteer/chrome/ -name "chrome_sandbox") &&\
|
||||
chmod 4755 $chrome_sandbox &&\
|
||||
cp $chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
|
||||
|
||||
WORKDIR /app/metagpt
|
||||
USER metagpt
|
||||
|
||||
# Running with an infinite loop using the tail command
|
||||
CMD ["sh", "-c", "tail -f /dev/null"]
|
||||
27
README.md
27
README.md
|
|
@ -55,27 +55,34 @@ ### 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
|
||||
mkdir -p /opt/metagpt/{config,workspace} && chmod 777 -R /opt/metagpt
|
||||
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 \
|
||||
# Step 2: Run metagpt demo with container
|
||||
docker run --rm \
|
||||
--privileged \
|
||||
-v /opt/metagpt/config:/app/metagpt/config \
|
||||
-v /opt/metagpt/workspace:/app/metagpt/workspace \
|
||||
metagpt/metagpt:v0.1
|
||||
metagpt/metagpt:v0.2 \
|
||||
python startup.py "Write a cli snake game"
|
||||
|
||||
# You can also start a container and execute commands in it
|
||||
docker run --name metagpt -d \
|
||||
--privileged \
|
||||
-v /opt/metagpt/config:/app/metagpt/config \
|
||||
-v /opt/metagpt/workspace:/app/metagpt/workspace \
|
||||
metagpt/metagpt:v0.2
|
||||
|
||||
# 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"
|
||||
$ 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`
|
||||
- Run in privileged mode to have permission to run the browser
|
||||
- Map host directory `/opt/metagtp/config` to container directory `/app/metagpt/config`
|
||||
- Map host directory `/opt/metagpt/workspace` to container directory `/app/metagpt/workspace`
|
||||
- Execute the demo command `python startup.py "Write a cli snake game"`
|
||||
|
||||
### Build image by yourself
|
||||
```bash
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue