Subham9126 commited on
Commit
e3820a1
·
verified ·
1 Parent(s): 1e588d4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -17
Dockerfile CHANGED
@@ -1,26 +1,30 @@
1
- # Use the naskio image which already has Python 3.10+ installed
2
  FROM naskio/n8n-python:2.13.0
3
  LABEL maintainer="Xiaoliang <xiaoliang.zero@gmail.com>"
4
 
5
- # 1. Mandatory for n8n 2.x: Switch to root to fix permissions and env setup
6
- USER root
 
7
 
8
- # 2. Fix the "Python missing" error in n8n 2.x
9
- # We tell n8n where the existing Python binary is so it doesn't fail the check
 
 
 
10
  ENV N8N_PYTHON_BINARY=/usr/bin/python3 \
11
- N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
 
12
  N8N_PROXY_HOPS=1 \
13
- NODE_FUNCTION_ALLOW_EXTERNAL="*"
14
-
15
- # 3. List the Python libraries you need here
16
- # n8n will automatically pip install these into its internal runner on startup
17
- ENV N8N_RUNNERS_PY_PACKAGES="pandas numpy requests beautifulsoup4"
18
 
19
- # 4. Switch back to the node user (naskio image uses 'node' just like official)
20
- USER node
21
 
22
- # Standard n8n setup
23
- VOLUME ["/home/node/.n8n"]
24
- EXPOSE 5678
25
 
26
- ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
 
 
 
1
+ # Use the naskio image for built-in Python
2
  FROM naskio/n8n-python:2.13.0
3
  LABEL maintainer="Xiaoliang <xiaoliang.zero@gmail.com>"
4
 
5
+ # 1. We must stay as USER node for HF Spaces compatibility
6
+ # We do NOT use 'USER root' to avoid 'su-exec' or 'chown' errors at runtime
7
+ USER node
8
 
9
+ # 2. Environment Configuration for HF Spaces
10
+ # - N8N_PYTHON_BINARY: Points to the Python path
11
+ # - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS: Set to false to stop n8n from trying to chown files
12
+ # - N8N_PORT: HF Spaces listens on 7860
13
+ # - N8N_RUNNERS_PY_PACKAGES: Auto-installs your libraries
14
  ENV N8N_PYTHON_BINARY=/usr/bin/python3 \
15
+ N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=false \
16
+ N8N_PORT=7860 \
17
  N8N_PROXY_HOPS=1 \
18
+ NODE_FUNCTION_ALLOW_EXTERNAL="*" \
19
+ N8N_RUNNERS_PY_PACKAGES="pandas numpy requests" \
20
+ HOME=/home/node
 
 
21
 
22
+ # 3. Set the working directory to the user's home
23
+ WORKDIR /home/node
24
 
25
+ # 4. Expose the HF Space port
26
+ EXPOSE 7860
 
27
 
28
+ # 5. Overwrite the entrypoint
29
+ # We call n8n directly instead of using the default script to avoid 'su-exec' permission errors
30
+ ENTRYPOINT ["tini", "--", "n8n"]