baoyin2024 commited on
Commit
17c0c8b
·
verified ·
1 Parent(s): 4d7c889

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -5
Dockerfile CHANGED
@@ -1,8 +1,5 @@
1
  FROM node:18-alpine
2
 
3
- # Set user to root for installation
4
- USER root
5
-
6
  # Arguments that can be passed at build time
7
  ARG N8N_PATH=/usr/local/lib/node_modules/n8n
8
  ARG BASE_PATH=/root/.n8n
@@ -33,6 +30,7 @@ RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-d
33
  # Install custom fonts
34
  RUN mkdir -p /usr/share/fonts/truetype/custom
35
  COPY ./fonts/HanyiSentyPagoda_Regular.ttf /usr/share/fonts/truetype/custom/
 
36
  RUN fc-cache -f -v
37
 
38
  # Set environment variables
@@ -43,8 +41,17 @@ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
43
  RUN npm install -g [email protected]
44
 
45
  # Create necessary directories
46
- RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH \
47
- && chmod -R 777 $BASE_PATH
 
 
 
 
 
 
 
 
 
48
 
49
  # Set working directory
50
  WORKDIR /data
@@ -53,3 +60,4 @@ WORKDIR /data
53
  CMD ["n8n", "start"]
54
 
55
 
 
 
1
  FROM node:18-alpine
2
 
 
 
 
3
  # Arguments that can be passed at build time
4
  ARG N8N_PATH=/usr/local/lib/node_modules/n8n
5
  ARG BASE_PATH=/root/.n8n
 
30
  # Install custom fonts
31
  RUN mkdir -p /usr/share/fonts/truetype/custom
32
  COPY ./fonts/HanyiSentyPagoda_Regular.ttf /usr/share/fonts/truetype/custom/
33
+ RUN chmod 644 /usr/share/fonts/truetype/custom/HanyiSentyPagoda_Regular.ttf # 确保字体文件具有读取权限
34
  RUN fc-cache -f -v
35
 
36
  # Set environment variables
 
41
  RUN npm install -g [email protected]
42
 
43
  # Create necessary directories
44
+ RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH
45
+
46
+ # Chown the directories to the n8n user (if n8n has a specific user)
47
+ # If n8n doesn't have a specific user, you can remove this section
48
+ RUN addgroup -g 1000 n8n && \
49
+ adduser -u 1000 -G n8n -s /bin/sh -D n8n
50
+
51
+ RUN chown -R n8n:n8n $BASE_PATH
52
+
53
+ # Switch to the n8n user. If n8n doesn't have a user, remove this.
54
+ USER n8n
55
 
56
  # Set working directory
57
  WORKDIR /data
 
60
  CMD ["n8n", "start"]
61
 
62
 
63
+