Spaces:
Sleeping
Sleeping
sanbo
commited on
Commit
·
3e9ad7b
1
Parent(s):
1454ac5
update sth. at 2025-01-26 01:25:12
Browse files- Dockerfile +1 -60
- Dockerfile_dks +60 -0
Dockerfile
CHANGED
@@ -1,60 +1 @@
|
|
1 |
-
|
2 |
-
FROM python:3.11-slim
|
3 |
-
|
4 |
-
# 设置工作目录
|
5 |
-
WORKDIR /app
|
6 |
-
|
7 |
-
# 以root用户安装系统依赖
|
8 |
-
RUN apt-get update && apt-get install -y \
|
9 |
-
fonts-ipafont-gothic \
|
10 |
-
fonts-wqy-zenhei \
|
11 |
-
fonts-thai-tlwg \
|
12 |
-
fonts-kacst \
|
13 |
-
fonts-freefont-ttf \
|
14 |
-
libxss1 \
|
15 |
-
libnss3 \
|
16 |
-
libnspr4 \
|
17 |
-
libatk1.0-0 \
|
18 |
-
libatk-bridge2.0-0 \
|
19 |
-
libcups2 \
|
20 |
-
libdrm2 \
|
21 |
-
libxkbcommon0 \
|
22 |
-
libxcomposite1 \
|
23 |
-
libxdamage1 \
|
24 |
-
libxfixes3 \
|
25 |
-
libxrandr2 \
|
26 |
-
libgbm1 \
|
27 |
-
libasound2 \
|
28 |
-
&& rm -rf /var/lib/apt/lists/*
|
29 |
-
|
30 |
-
# 创建非root用户
|
31 |
-
RUN useradd -m -d /home/playwright playwright
|
32 |
-
|
33 |
-
# 设置环境变量
|
34 |
-
ENV PLAYWRIGHT_BROWSERS_PATH=/home/playwright/.cache/ms-playwright
|
35 |
-
ENV PATH="/home/playwright/.local/bin:${PATH}"
|
36 |
-
ENV PYTHONUNBUFFERED=1
|
37 |
-
ENV DEBUG=false
|
38 |
-
ENV PORT=7860
|
39 |
-
|
40 |
-
# 复制requirements.txt并安装依赖
|
41 |
-
COPY requirements.txt .
|
42 |
-
RUN pip install --no-cache-dir -r requirements.txt && \
|
43 |
-
playwright install chromium --with-deps
|
44 |
-
|
45 |
-
# 设置必要的目录和权限
|
46 |
-
RUN mkdir -p /home/playwright/.cache/ms-playwright && \
|
47 |
-
chown -R playwright:playwright /home/playwright && \
|
48 |
-
chmod -R 755 /home/playwright/.cache
|
49 |
-
|
50 |
-
# 复制项目文件并设置权限
|
51 |
-
COPY --chown=playwright:playwright . .
|
52 |
-
|
53 |
-
# 切换到非root用户
|
54 |
-
USER playwright
|
55 |
-
|
56 |
-
# 暴露端口
|
57 |
-
EXPOSE 7860
|
58 |
-
|
59 |
-
# 启动命令
|
60 |
-
CMD ["python", "more_core.py"]
|
|
|
1 |
+
FROM ghcr.io/hhhaiai/pekingduck:latest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dockerfile_dks
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 使用官方Python镜像
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# 设置工作目录
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# 以root用户安装系统依赖
|
8 |
+
RUN apt-get update && apt-get install -y \
|
9 |
+
fonts-ipafont-gothic \
|
10 |
+
fonts-wqy-zenhei \
|
11 |
+
fonts-thai-tlwg \
|
12 |
+
fonts-kacst \
|
13 |
+
fonts-freefont-ttf \
|
14 |
+
libxss1 \
|
15 |
+
libnss3 \
|
16 |
+
libnspr4 \
|
17 |
+
libatk1.0-0 \
|
18 |
+
libatk-bridge2.0-0 \
|
19 |
+
libcups2 \
|
20 |
+
libdrm2 \
|
21 |
+
libxkbcommon0 \
|
22 |
+
libxcomposite1 \
|
23 |
+
libxdamage1 \
|
24 |
+
libxfixes3 \
|
25 |
+
libxrandr2 \
|
26 |
+
libgbm1 \
|
27 |
+
libasound2 \
|
28 |
+
&& rm -rf /var/lib/apt/lists/*
|
29 |
+
|
30 |
+
# 创建非root用户
|
31 |
+
RUN useradd -m -d /home/playwright playwright
|
32 |
+
|
33 |
+
# 设置环境变量
|
34 |
+
ENV PLAYWRIGHT_BROWSERS_PATH=/home/playwright/.cache/ms-playwright
|
35 |
+
ENV PATH="/home/playwright/.local/bin:${PATH}"
|
36 |
+
ENV PYTHONUNBUFFERED=1
|
37 |
+
ENV DEBUG=false
|
38 |
+
ENV PORT=7860
|
39 |
+
|
40 |
+
# 复制requirements.txt并安装依赖
|
41 |
+
COPY requirements.txt .
|
42 |
+
RUN pip install --no-cache-dir -r requirements.txt && \
|
43 |
+
playwright install chromium --with-deps
|
44 |
+
|
45 |
+
# 设置必要的目录和权限
|
46 |
+
RUN mkdir -p /home/playwright/.cache/ms-playwright && \
|
47 |
+
chown -R playwright:playwright /home/playwright && \
|
48 |
+
chmod -R 755 /home/playwright/.cache
|
49 |
+
|
50 |
+
# 复制项目文件并设置权限
|
51 |
+
COPY --chown=playwright:playwright . .
|
52 |
+
|
53 |
+
# 切换到非root用户
|
54 |
+
USER playwright
|
55 |
+
|
56 |
+
# 暴露端口
|
57 |
+
EXPOSE 7860
|
58 |
+
|
59 |
+
# 启动命令
|
60 |
+
CMD ["python", "more_core.py"]
|