Subham9126 commited on
Commit
7e1cf81
·
verified ·
1 Parent(s): 61af5c2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -16
Dockerfile CHANGED
@@ -2,28 +2,31 @@ FROM n8nio/runners:latest
2
 
3
  USER root
4
 
5
- # 1. Install Node.js, npm, and Python venv (Debian)
6
- RUN apt-get update && \
7
- apt-get install -y nodejs npm python3-venv && \
8
- rm -rf /var/lib/apt/lists/*
9
 
10
- # 2. Install Python libraries
11
- # Using pip directly; --break-system-packages is needed for modern Debian images
12
- RUN pip install --no-cache-dir --break-system-packages pandas numpy requests beautifulsoup4
13
 
14
- # 3. Install JS libraries (npm now exists)
15
- RUN cd /opt/runners/task-runner-javascript && \
16
- npm install lodash axios
 
17
 
18
- # 4. Copy your custom config
 
19
  COPY n8n-task-runners.json /etc/n8n-task-runners.json
20
 
21
- # 5. Connection Settings
22
- # REPLACE 'your-user-n8n-main' with your real n8n Space URL
23
  ENV N8N_RUNNERS_AUTH_TOKEN=test \
24
- N8N_RUNNERS_TASK_BROKER_URI=https://your-user-n8n-main-space.hf.space \
25
  N8N_RUNNERS_CONFIG_FILE=/etc/n8n-task-runners.json
26
 
 
27
  USER runner
28
- # The launcher will automatically start all runners defined in the JSON file
29
- ENTRYPOINT ["node", "/opt/runners/launcher/dist/index.js"]
 
 
 
2
 
3
  USER root
4
 
5
+ # 1. Install system build tools (Alpine)
6
+ RUN apk add --no-cache make g++ python3-dev
 
 
7
 
8
+ # 2. Install Python libraries using the built-in 'uv' (Official n8n way)
9
+ # We target the existing venv in the image
10
+ RUN uv pip install --no-cache pandas numpy requests beautifulsoup4
11
 
12
+ # 3. Install JS libraries using the built-in 'pnpm'
13
+ # We must use the specific directory defined in the base image
14
+ WORKDIR /opt/runners/task-runner-javascript
15
+ RUN pnpm add lodash axios
16
 
17
+ # 4. Copy your custom config (Ensure this is in your HF repo)
18
+ WORKDIR /home/runner
19
  COPY n8n-task-runners.json /etc/n8n-task-runners.json
20
 
21
+ # 5. Connection Settings for HF Spaces
22
+ # IMPORTANT: N8N_RUNNERS_TASK_BROKER_URI must point to your Main Space
23
  ENV N8N_RUNNERS_AUTH_TOKEN=test \
24
+ N8N_RUNNERS_TASK_BROKER_URI=https://your-user-n8n-main.hf.space \
25
  N8N_RUNNERS_CONFIG_FILE=/etc/n8n-task-runners.json
26
 
27
+ # Switch back to the runner user (UID 1000)
28
  USER runner
29
+
30
+ # Use the official launcher to start both JS and Python
31
+ ENTRYPOINT ["tini", "--", "/usr/local/bin/task-runner-launcher"]
32
+ CMD ["javascript", "python"]