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