Update Dockerfile
Browse files- Dockerfile +14 -16
Dockerfile
CHANGED
@@ -1,40 +1,38 @@
|
|
1 |
-
#
|
2 |
-
FROM node:slim
|
|
|
|
|
|
|
3 |
|
4 |
# 设置工作目录
|
5 |
WORKDIR /home/node/app
|
6 |
|
7 |
-
# 安装 Python3, pip, rclone
|
8 |
RUN apt-get update && \
|
9 |
apt-get install -y --no-install-recommends \
|
10 |
python3 python3-pip rclone fuse \
|
11 |
wget curl unzip vim git procps lsof net-tools \
|
12 |
ca-certificates openssl gnupg && \
|
|
|
|
|
|
|
13 |
apt-get clean && \
|
14 |
rm -rf /var/lib/apt/lists/*
|
15 |
|
|
|
|
|
|
|
16 |
# 全局安装 n8n
|
17 |
RUN npm install n8n -g
|
18 |
|
19 |
-
# 运行阶段
|
20 |
-
FROM node:slim
|
21 |
-
|
22 |
-
# 从构建阶段复制必要的文件
|
23 |
-
COPY --from=builder /usr/bin/rclone /usr/bin/rclone
|
24 |
-
COPY --from=builder /usr/bin/fusermount /usr/bin/fusermount
|
25 |
-
COPY --from=builder /home/node/app /home/node/app
|
26 |
-
|
27 |
-
# 设置工作目录
|
28 |
-
WORKDIR /home/node/app
|
29 |
-
|
30 |
# 复制启动脚本并赋予执行权限
|
31 |
COPY entrypoint.sh /entrypoint.sh
|
32 |
RUN chmod +x /entrypoint.sh
|
33 |
|
34 |
-
#
|
35 |
USER node
|
36 |
|
37 |
-
#
|
38 |
ENV N8N_HOST=0.0.0.0
|
39 |
ENV N8N_PORT=5678
|
40 |
ENV N8N_PROTOCOL=https
|
|
|
1 |
+
# 使用官方的 Node.js 镜像,基于 Debian Slim 版本,更加精简
|
2 |
+
FROM node:slim
|
3 |
+
|
4 |
+
# 切换到 root 用户以安装必要的软件包
|
5 |
+
USER root
|
6 |
|
7 |
# 设置工作目录
|
8 |
WORKDIR /home/node/app
|
9 |
|
10 |
+
# 安装 Python3, pip, rclone 及其他常用工具
|
11 |
RUN apt-get update && \
|
12 |
apt-get install -y --no-install-recommends \
|
13 |
python3 python3-pip rclone fuse \
|
14 |
wget curl unzip vim git procps lsof net-tools \
|
15 |
ca-certificates openssl gnupg && \
|
16 |
+
apt-get install -y tzdata && \
|
17 |
+
ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
18 |
+
dpkg-reconfigure --frontend noninteractive tzdata && \
|
19 |
apt-get clean && \
|
20 |
rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
+
# 设置目录权限
|
23 |
+
RUN chown -R node:node /home/node
|
24 |
+
|
25 |
# 全局安装 n8n
|
26 |
RUN npm install n8n -g
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# 复制启动脚本并赋予执行权限
|
29 |
COPY entrypoint.sh /entrypoint.sh
|
30 |
RUN chmod +x /entrypoint.sh
|
31 |
|
32 |
+
# 切换回 node 用户
|
33 |
USER node
|
34 |
|
35 |
+
# 设置环境变量,包括时区设置
|
36 |
ENV N8N_HOST=0.0.0.0
|
37 |
ENV N8N_PORT=5678
|
38 |
ENV N8N_PROTOCOL=https
|