1- # This Dockerfile is friendly to users in Chinese Mainland :)
1+ # This Dockerfile is friendly to users in Chinese Mainland :)
22# For users outside mainland China, feel free to modify or delete them :)
33
44# Use a base image with Python 3.9.17 slim version (Bullseye)
@@ -7,15 +7,20 @@ FROM python:3.9.17-slim-bullseye
77# Install Debian software needed by MetaGPT
88RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list &&\
99 apt update &&\
10- apt install -y git curl wget build-essential gcc clang g++ make &&\
10+ apt install -y git curl wget build-essential gcc clang g++ make gnupg &&\
1111 curl -sL https://deb.nodesource.com/setup_19.x | bash - &&\
1212 apt install -y nodejs &&\
13+ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &&\
14+ sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' &&\
15+ apt-get update &&\
16+ 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 &&\
1317 apt-get clean
1418
1519# Set the working directory to /app
1620WORKDIR /app
1721
1822# Install Mermaid CLI globally and clone the MetaGPT repository
23+ # ENV PUPPETEER_SKIP_DOWNLOAD='true'
1924RUN npm config set registry https://registry.npm.taobao.org &&\
2025 npm install -g @mermaid-js/mermaid-cli &&\
2126 npm cache clean --force &&\
@@ -29,6 +34,17 @@ RUN cd metagpt &&\
2934 pip cache purge &&\
3035 python setup.py install
3136
32- # Running with an infinite loop using the tail command
33- CMD ["sh" , "-c" , "tail -f /dev/null" ]
37+ # Add metagpt user so we don't need --no-sandbox when use puppeteer
38+ RUN useradd -m metagpt -s /bin/bash &&\
39+ chown metagpt -R /app/metagpt &&\
40+ cp -r /root/.cache /home/metagpt/ &&\
41+ chown metagpt -R /home/metagpt/.cache &&\
42+ chrome_sandbox=$(find /root/.cache/puppeteer/chrome/ -name "chrome_sandbox" ) &&\
43+ chmod 4755 $chrome_sandbox &&\
44+ cp $chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
45+
46+ WORKDIR /app/metagpt
47+ USER metagpt
3448
49+ # Running with an infinite loop using the tail command
50+ CMD ["sh" , "-c" , "tail -f /dev/null" ]
0 commit comments