try
Browse files- Dockerfile +13 -24
Dockerfile
CHANGED
@@ -54,34 +54,23 @@ RUN apt-get update && apt-get install -y \
|
|
54 |
|
55 |
WORKDIR /app
|
56 |
|
57 |
-
# 复制requirements文件
|
58 |
-
COPY requirements.txt .
|
59 |
-
|
60 |
-
# 安装Python依赖
|
61 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
62 |
|
63 |
-
#
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
ENV TMPDIR=/app/.cache/tmp
|
69 |
-
ENV TMP=/app/.cache/tmp
|
70 |
-
ENV TEMP=/app/.cache/tmp
|
71 |
-
|
72 |
-
# 创建缓存目录并设置权限
|
73 |
-
RUN mkdir -p /app/.cache/ms-playwright /app/.cache/tmp && \
|
74 |
-
chmod -R 755 /app/.cache
|
75 |
|
76 |
-
#
|
77 |
-
RUN playwright install
|
78 |
-
(echo "第一次安装失败,尝试不使用--with-deps" && playwright install chromium)
|
79 |
|
80 |
-
#
|
81 |
-
|
|
|
|
|
82 |
|
83 |
-
#
|
84 |
-
RUN
|
85 |
|
86 |
# 暴露端口
|
87 |
EXPOSE 7860
|
|
|
54 |
|
55 |
WORKDIR /app
|
56 |
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
+
# RUN pip install --no-cache-dir -r requirements.txt
|
59 |
+
# Install Python dependencies
|
60 |
+
RUN pip install --upgrade pip
|
61 |
+
COPY requirements.txt .
|
62 |
+
RUN pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
# Install Playwright and download the required browsers
|
65 |
+
RUN playwright install --with-deps
|
|
|
66 |
|
67 |
+
# Create and switch to a non-root user
|
68 |
+
RUN useradd -m -u 1000 user
|
69 |
+
USER user
|
70 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
71 |
|
72 |
+
# Ensure Playwright browsers are installed for the non-root user
|
73 |
+
RUN playwright install
|
74 |
|
75 |
# 暴露端口
|
76 |
EXPOSE 7860
|