forked from FoundationAgents/OpenManus
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile.run_api
More file actions
70 lines (56 loc) · 1.69 KB
/
Copy pathDockerfile.run_api
File metadata and controls
70 lines (56 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 构建阶段
FROM python:3.12-slim AS builder
WORKDIR /build
# 安装构建依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# 安装 uv
RUN pip install --no-cache-dir uv
# 复制依赖文件
COPY requirements.txt .
# 安装依赖
RUN uv pip install --system -r requirements.txt
# 运行阶段
FROM python:3.12-slim
WORKDIR /app
# 安装系统依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
gnupg \
ca-certificates \
lsb-release \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& 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 --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
&& rm -rf /var/lib/apt/lists/*
# 安装 Docker CLI
RUN apt-get update && apt-get install -y --no-install-recommends \
docker.io \
&& rm -rf /var/lib/apt/lists/*
# 验证安装
RUN which docker
RUN docker --version
# 从构建阶段复制已安装的依赖
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# 安装 Playwright 浏览器
RUN playwright install chromium
RUN playwright install-deps
# 复制应用代码
COPY ./app ./app
COPY ./run_api.py ./run_api.py
COPY ./config ./config
# 设置环境变量
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# 启动命令
CMD ["python", "run_api.py"]