HuggingFace0920 commited on
Commit
87e3d51
·
verified ·
1 Parent(s): 42e2be3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -18
Dockerfile CHANGED
@@ -2,27 +2,23 @@
2
  FROM ubuntu:22.04
3
  EXPOSE 5244
4
 
5
- # 设置环境变量
6
- ENV TZ=Asia/Shanghai \
7
- APP_HOME=/OpenList \
8
- VIRTUAL_ENV=$APP_HOME/venv
9
-
10
  # 设置时区
 
11
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
12
  echo $TZ > /etc/timezone
13
 
14
- # 安装系统依赖(包括python3-venv)
15
  RUN apt-get update && \
16
- apt-get install -y wget tar python3 python3-pip python3-venv && \
17
  rm -rf /var/lib/apt/lists/*
18
 
19
- # 创建应用目录
20
- WORKDIR $APP_HOME
 
 
21
 
22
- # 设置虚拟环境和安装Python依赖
23
- RUN python3 -m venv $VIRTUAL_ENV && \
24
- $VIRTUAL_ENV/bin/pip install --no-cache-dir --upgrade pip setuptools wheel && \
25
- $VIRTUAL_ENV/bin/pip install --no-cache-dir huggingface_hub
26
 
27
  # 下载并解压 OpenList
28
  RUN wget -q https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-linux-amd64.tar.gz && \
@@ -31,18 +27,18 @@ RUN wget -q https://github.com/OpenListTeam/OpenList/releases/download/beta/open
31
  rm -rf openlist-linux-amd64.tar.gz *linux-amd64*
32
 
33
  # 创建数据目录并设置权限
34
- RUN mkdir -p $APP_HOME/data && \
35
- chmod -R 777 $APP_HOME/data
36
 
37
  # 复制并设置脚本权限
38
  COPY sync_data.sh ./
39
- RUN chmod +x openlist sync_data.sh
40
 
41
  # 设置非root用户运行
42
  RUN useradd -m openlistuser && \
43
- chown -R openlistuser:openlistuser $APP_HOME
44
 
45
  USER openlistuser
46
 
47
  # 启动服务
48
- CMD ./sync_data.sh && ./openlist server
 
2
  FROM ubuntu:22.04
3
  EXPOSE 5244
4
 
 
 
 
 
 
5
  # 设置时区
6
+ ENV TZ=Asia/Shanghai
7
  RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
8
  echo $TZ > /etc/timezone
9
 
10
+ # 安装系统依赖
11
  RUN apt-get update && \
12
+ apt-get install -y wget tar python3 python3-pip && \
13
  rm -rf /var/lib/apt/lists/*
14
 
15
+ ENV VIRTUAL_ENV=/opt/venv
16
+ RUN python3 -m venv $VIRTUAL_ENV
17
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
18
+ RUN pip install --no-cache-dir huggingface_hub
19
 
20
+ # 设置工作目录
21
+ WORKDIR /OpenList
 
 
22
 
23
  # 下载并解压 OpenList
24
  RUN wget -q https://github.com/OpenListTeam/OpenList/releases/download/beta/openlist-linux-amd64.tar.gz && \
 
27
  rm -rf openlist-linux-amd64.tar.gz *linux-amd64*
28
 
29
  # 创建数据目录并设置权限
30
+ RUN mkdir -p /OpenList/data && \
31
+ chmod -R 777 /OpenList/data
32
 
33
  # 复制并设置脚本权限
34
  COPY sync_data.sh ./
35
+ RUN chmod 755 openlist sync_data.sh
36
 
37
  # 设置非root用户运行
38
  RUN useradd -m openlistuser && \
39
+ chown -R openlistuser:openlistuser /OpenList
40
 
41
  USER openlistuser
42
 
43
  # 启动服务
44
+ CMD ["./sync_data.sh && ./openlist", "server"]