hayou2002 commited on
Commit
1af940a
·
verified ·
1 Parent(s): 340f2f5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -10
Dockerfile CHANGED
@@ -1,20 +1,23 @@
 
1
  FROM python:3.11-bullseye
2
  USER root
3
- # 配置国内源加速
4
- RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list && \
5
- sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
6
- # 安装依赖
7
  RUN apt-get update && apt-get install -y --no-install-recommends git gcc g++ make && \
8
  rm -rf /var/lib/apt/lists/*
9
- # 配置HF持久化目录
 
10
  ENV OPENLIT_DATA_DIR=/data
11
  VOLUME ["/data"]
12
  RUN mkdir -p /data/uploads && chmod -R 777 /data
13
- # 步骤1:用国内镜像克隆OpenLit(加快速度)
 
14
  WORKDIR /app
15
- RUN git clone --depth=1 --timeout=180 https://github.com.cnpmjs.org/openlit/openlit.git .
16
- # 步骤2:pip安装依赖(增加超时参数)
17
- RUN pip install --no-cache-dir --default-timeout=180 -e .[all]
18
- # HF适配启动
 
 
19
  EXPOSE 7860
20
  CMD ["openlit", "serve", "--host", "0.0.0.0", "--port", "7860", "--root-path", "/v1"]
 
1
+ # 适配HF国外服务器,用官方源+直接访问GitHub(速度快)
2
  FROM python:3.11-bullseye
3
  USER root
4
+
5
+ # 用Debian官方源(HF国外服务器访问更快)
 
 
6
  RUN apt-get update && apt-get install -y --no-install-recommends git gcc g++ make && \
7
  rm -rf /var/lib/apt/lists/*
8
+
9
+ # 配置HF持久化目录(文件重启不丢失)
10
  ENV OPENLIT_DATA_DIR=/data
11
  VOLUME ["/data"]
12
  RUN mkdir -p /data/uploads && chmod -R 777 /data
13
+
14
+ # 直接克隆OpenLit官方GitHub(HF国外服务器访问GitHub速度快)
15
  WORKDIR /app
16
+ RUN git clone --depth=1 https://github.com/openlit/openlit.git .
17
+
18
+ # 安装最新版依赖
19
+ RUN pip install --no-cache-dir -e .[all]
20
+
21
+ # HF强制适配启动
22
  EXPOSE 7860
23
  CMD ["openlit", "serve", "--host", "0.0.0.0", "--port", "7860", "--root-path", "/v1"]