hijnu commited on
Commit
46c8863
·
verified ·
1 Parent(s): 7d8d6c6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -28
Dockerfile CHANGED
@@ -1,34 +1,29 @@
1
- FROM n8nio/n8n:latest
 
2
 
3
- ENV NODE_ENV=production
 
4
 
5
- USER root
6
- RUN chmod 777 /usr/local/lib/node_modules
7
 
8
- RUN apk update && apk add --no-cache postgresql-client && rm -rf /var/cache/apk/*
 
 
 
 
 
9
 
10
- RUN set -eux; \
11
- apkArch="$(apk --print-arch)"; \
12
- if [ "$apkArch" = "armv7" ]; then \
13
- apk --no-cache add --virtual build-dependencies python3 build-base && \
14
- apk del build-dependencies; \
15
- fi; \
16
- find /usr/local/lib/node_modules/n8n -type f \( -name "*.ts" -o -name "*.js.map" -o -name "*.vue" \) -delete && \
17
- rm -rf /root/.npm
18
 
19
- RUN mkdir -p /home/node/.n8n/nodes
20
- WORKDIR /home/node/.n8n/nodes
21
- RUN npm install n8n-nodes-browserless
22
- RUN ls -lah
23
 
24
- # Set a custom user to not have n8n run as root
25
- WORKDIR /data
26
- RUN apk --no-cache add tini
27
- COPY docker-entrypoint.sh /docker-entrypoint.sh
28
- RUN chmod +x /docker-entrypoint.sh
29
- RUN chmod 777 /usr/local/lib/node_modules
30
- RUN chmod -R 777 /home/node/.n8n/nodes
31
- ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
32
-
33
- # 默认用户切换
34
- USER node
 
1
+ # 使用官方的 Node.js 镜像,基于 Debian Slim 版本,更加精简
2
+ FROM node:slim
3
 
4
+ # 设置工作目录
5
+ WORKDIR /home/node/app
6
 
7
+ # 全局安装 n8n
8
+ RUN npm install n8n -g
9
 
10
+ # 设置环境变量,包括时区设置
11
+ ENV N8N_HOST=0.0.0.0
12
+ ENV N8N_PORT=5678
13
+ ENV N8N_PROTOCOL=https
14
+ ENV WEBHOOK_URL=https://hijnu-n8n.hf.space/
15
+ ENV GENERIC_TIMEZONE=Asia/Shanghai
16
 
17
+ # 安装 tzdata 包以支持时区设置
18
+ RUN apt-get update && \
19
+ apt-get install -y tzdata && \
20
+ ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
21
+ dpkg-reconfigure --frontend noninteractive tzdata && \
22
+ apt-get clean && \
23
+ rm -rf /var/lib/apt/lists/*
 
24
 
25
+ # 暴露 n8n 端口
26
+ EXPOSE 5678
 
 
27
 
28
+ # 启动 n8n
29
+ CMD ["n8n", "start"]