NeoLee commited on
Commit
f9ab3f0
·
verified ·
1 Parent(s): 7ddaf02

update docker

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -27
Dockerfile CHANGED
@@ -1,42 +1,29 @@
1
  # 使用 Node.js 作为基础镜像(因为 Gemini CLI 依赖较多)
2
  FROM node:20-slim
3
 
4
- # 安装 Python, curl, wget 和进程管理工具 supervisor
5
- RUN apt-get update && apt-get install -y \
6
- python3 \
7
- python3-pip \
8
- curl \
9
- wget \
10
- supervisor \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # 安装 cloudflared (Cloudflare Tunnel 客户端)
14
  RUN curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && \
15
- dpkg -i cloudflared.deb && \
16
- rm cloudflared.deb
17
 
18
- # 创建非 root 用户(HF 安全要求
19
  RUN useradd -m -u 1000 user
20
  USER user
21
- ENV PATH="/home/user/.local/bin:$PATH"
22
- WORKDIR /home/user/app
23
-
24
- # 1. 安装 Gemini CLI (参考文档 [paragraph-14])
25
- RUN npm install -g @google/gemini-cli
26
 
27
- # 2. 准备 Python 环境
28
- COPY --chown=user requirements.txt .
29
- RUN pip3 install --no-cache-dir -r requirements.txt
30
 
31
- # 3. 拷贝所有代码
32
  COPY --chown=user . .
33
 
34
- # 4. 配置 Supervisor 来管理多进程
35
- # 我们需要同时启动:Flask(7860端口), Gemini CLI Core, Cloudflared
36
- COPY --chown=user supervisord.conf /etc/supervisor/conf.d/supervisord.conf
37
 
38
- # 暴露 HF 指定的端口
39
  EXPOSE 7860
40
 
41
  # 启动 supervisor
42
- CMD ["/usr/bin/supervisord"]
 
1
  # 使用 Node.js 作为基础镜像(因为 Gemini CLI 依赖较多)
2
  FROM node:20-slim
3
 
4
+ # 安装必要依赖
5
+ RUN apt-get update && apt-get install -y python3 python3-pip curl wget supervisor && rm -rf /var/lib/apt/lists/*
6
+
7
+ # 安装 cloudflared
 
 
 
 
 
 
8
  RUN curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && \
9
+ dpkg -i cloudflared.deb && rm cloudflared.deb
 
10
 
11
+ # 创建用户(HF 默认使用 user id 1000
12
  RUN useradd -m -u 1000 user
13
  USER user
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
 
 
 
16
 
17
+ WORKDIR $HOME/app
 
 
18
 
19
+ # 关键:先确保文件存在再 COPY
20
  COPY --chown=user . .
21
 
22
+ # 安装 Flask
23
+ RUN pip3 install flask --user
 
24
 
25
+ # 暴露 HF 要求的端口
26
  EXPOSE 7860
27
 
28
  # 启动 supervisor
29
+ CMD ["/usr/bin/supervisord", "-c", "supervisord.conf"]