dragggl25 commited on
Commit
948ddac
·
verified ·
1 Parent(s): 5ab404f

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM dragon730/cloudpaste-backend:latest
2
+
3
+ # 设置工作目录
4
+ WORKDIR /app
5
+
6
+ # 更新包并安装必要的系统级依赖
7
+ # 包括 python3, py3-pip (用于pip), curl (用于WebDAV上传), bash (用于sync_data.sh的shebang), tar (用于打包解包)
8
+ RUN sed -i 's|https://mirrors.aliyun.com/alpine/latest-stable|https://dl-cdn.alpinelinux.org/alpine/latest-stable|g' /etc/apk/repositories && \
9
+ apk update && \
10
+ apk add --no-cache python3 py3-pip curl bash tar
11
+
12
+ # 创建Python虚拟环境并安装Python库依赖
13
+ RUN python3 -m venv /app/venv && \
14
+ /app/venv/bin/pip install --no-cache-dir webdavclient3 requests
15
+
16
+ # 复制同步脚本
17
+ COPY sync_data.sh /app/sync_data.sh
18
+
19
+ # 设置权限
20
+ RUN mkdir -p /data && \
21
+ chmod 777 /data && \
22
+ chmod +x /app/sync_data.sh
23
+
24
+ # 设置环境变量
25
+ # ERROR: 0, WARN: 1, INFO: 2, DEBUG: 3,
26
+ ENV NODE_ENV=production
27
+ ENV LOG_LEVEL=3
28
+ ENV RUNTIME_ENV=docker
29
+ ENV DATA_DIR=/data
30
+ ENV PORT=7860
31
+ ENV ENCRYPTION_SECRET=PLEASE_CHANGE_THIS_IN_PRODUCTION
32
+
33
+ # 暴露端口
34
+ EXPOSE 7860
35
+
36
+ # 启动命令
37
+ # 1. 启动 sync_data.sh 在后台 (&)
38
+ # 2. 使用 exec 启动 node server.js,使其成为容器的主进程
39
+ CMD ["bash", "-c", "/app/sync_data.sh & exec node --expose-gc server.js"]