Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -11
Dockerfile
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
# 设置环境变量
|
| 4 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 5 |
PYTHONUNBUFFERED=1
|
| 6 |
|
| 7 |
-
# 安装 Chrome
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
-
wget gnupg git procps \
|
| 10 |
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
| 11 |
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
| 12 |
&& apt-get update \
|
|
@@ -14,23 +13,27 @@ RUN apt-get update && apt-get install -y \
|
|
| 14 |
--no-install-recommends \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
-
# 设置用户
|
| 18 |
RUN useradd -m -u 1000 user
|
| 19 |
WORKDIR /app
|
| 20 |
RUN chown -R user:user /app
|
| 21 |
USER user
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
-
# 安装 Playwright
|
| 28 |
RUN playwright install chromium
|
| 29 |
RUN playwright install-deps
|
| 30 |
|
| 31 |
-
# 复制
|
| 32 |
-
COPY --chown=user:user . .
|
| 33 |
-
|
| 34 |
-
# 启动
|
| 35 |
RUN chmod +x run.sh
|
|
|
|
|
|
|
| 36 |
CMD ["./run.sh"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
PYTHONUNBUFFERED=1
|
| 5 |
|
| 6 |
+
# 1. 安装系统依赖 (Chrome, Git, curl等)
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
+
wget gnupg git procps curl \
|
| 9 |
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
| 10 |
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
|
| 11 |
&& apt-get update \
|
|
|
|
| 13 |
--no-install-recommends \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# 2. 设置用户
|
| 17 |
RUN useradd -m -u 1000 user
|
| 18 |
WORKDIR /app
|
| 19 |
RUN chown -R user:user /app
|
| 20 |
USER user
|
| 21 |
|
| 22 |
+
# 3. 【核心变化】自动克隆 Moltbot 官方源码
|
| 23 |
+
# 这样你就不用自己上传代码了
|
| 24 |
+
RUN git clone https://github.com/aiviy/Moltbot.git /app/moltbot
|
| 25 |
+
|
| 26 |
+
# 4. 安装 Python 依赖
|
| 27 |
+
WORKDIR /app/moltbot
|
| 28 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 29 |
|
| 30 |
+
# 安装 Playwright
|
| 31 |
RUN playwright install chromium
|
| 32 |
RUN playwright install-deps
|
| 33 |
|
| 34 |
+
# 5. 复制我们自己的启动脚本 (run.sh)
|
| 35 |
+
COPY --chown=user:user run.sh /app/moltbot/run.sh
|
|
|
|
|
|
|
| 36 |
RUN chmod +x run.sh
|
| 37 |
+
|
| 38 |
+
# 6. 启动
|
| 39 |
CMD ["./run.sh"]
|