sam12345324 commited on
Commit
e4e288e
·
verified ·
1 Parent(s): 63ba249

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -19
Dockerfile CHANGED
@@ -3,23 +3,6 @@ FROM node:20-slim
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
9
- ARG DATABASE_PATH=$BASE_PATH/database
10
- ARG CONFIG_PATH=$BASE_PATH/config
11
- ARG WORKFLOWS_PATH=$BASE_PATH/workflows
12
- ARG LOGS_PATH=$BASE_PATH/logs
13
- ARG N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=$N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS
14
- ARG N8N_HOST=$N8N_HOST
15
- ARG N8N_PORT=$N8N_PORT
16
- ARG N8N_PROTOCOL=https
17
- ARG N8N_EDITOR_BASE_URL=$N8N_EDITOR_BASE_URL
18
- ARG WEBHOOK_URL=$WEBHOOK_URL
19
- ARG GENERIC_TIMEZONE=$GENERIC_TIMEZONE
20
- ARG TZ=$TZ
21
- ARG N8N_ENCRYPTION_KEY=$N8N_ENCRYPTION_KEY
22
-
23
  # Install system dependencies required by sharp, imagemagick, graphicsmagick, and other image processing tools
24
  RUN apt update && apt install -y \
25
  ffmpeg \
@@ -57,6 +40,12 @@ RUN npm install -g sharp@0.33.5 jimp imagemagick
57
  # Install n8n globally (pinned to a stable version)
58
  RUN npm install -g n8n
59
 
 
 
 
 
 
 
60
  # Set working directory Hugging Face will use
61
  WORKDIR /workspace
62
 
@@ -70,10 +59,13 @@ ENV GENERIC_TIMEZONE=UTC
70
  # Enable verbose logging for sharp
71
  ENV SHARP_VERBOSE=true
72
 
73
- # Configure n8n to use SQLite (database stored in /workspace, persistent in HF Spaces)
74
  ENV DB_TYPE=sqlite
75
  ENV DB_SQLITE_VACUUM_ON_STARTUP=true
76
- ENV DB_SQLITE_DATABASE=/workspace/database.sqlite
 
 
 
77
 
78
  # Start n8n with tunnel enabled (to bypass Hugging Face networking)
79
  CMD ["n8n", "start", "--tunnel"]
 
3
  # Set user to root for installation
4
  USER root
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  # Install system dependencies required by sharp, imagemagick, graphicsmagick, and other image processing tools
7
  RUN apt update && apt install -y \
8
  ffmpeg \
 
40
  # Install n8n globally (pinned to a stable version)
41
  RUN npm install -g n8n
42
 
43
+ # Create a writable directory for SQLite database
44
+ RUN mkdir -p /workspace/data && chown -R node:node /workspace/data
45
+
46
+ # Switch to node user (Hugging Face default)
47
+ USER node
48
+
49
  # Set working directory Hugging Face will use
50
  WORKDIR /workspace
51
 
 
59
  # Enable verbose logging for sharp
60
  ENV SHARP_VERBOSE=true
61
 
62
+ # Configure n8n to use SQLite (database stored in /workspace/data, node user has permission)
63
  ENV DB_TYPE=sqlite
64
  ENV DB_SQLITE_VACUUM_ON_STARTUP=true
65
+ ENV DB_SQLITE_DATABASE=/workspace/data/database.sqlite
66
+
67
+ # Auto-fix config permissions
68
+ ENV N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
69
 
70
  # Start n8n with tunnel enabled (to bypass Hugging Face networking)
71
  CMD ["n8n", "start", "--tunnel"]