chandrakant-s4 commited on
Commit
986dd84
·
verified ·
1 Parent(s): 03cc98e

duplicate repo added

Browse files
Files changed (1) hide show
  1. Dockerfile +45 -25
Dockerfile CHANGED
@@ -1,27 +1,47 @@
1
- FROM n8nio/n8n:latest
2
-
3
- # Switch to root to install PostgreSQL client
4
- USER root
5
-
6
- # Install PostgreSQL client
7
- RUN apk add --no-cache postgresql-client
8
-
9
- # Restore correct permissions for n8n
10
- RUN mkdir -p /home/node/.n8n && \
11
- chown -R node:node /home/node/.n8n
12
-
13
- # Revert back to node user
14
- USER node
15
 
16
  # Set working directory
17
- WORKDIR /home/node
18
-
19
- # Health check (optional)
20
- HEALTHCHECK --interval=30s --timeout=5s --start-period=30s \
21
- CMD curl -f http://localhost:5678/healthz || exit 1
22
-
23
- # Expose n8n default port
24
- EXPOSE 5678
25
-
26
- # Use the default entrypoint and command (don't override CMD)
27
- # CMD ["n8n", "start"] <- remove this line!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Node.js 22 as base image (required for n8n v1.x)
2
+ FROM node:22-bullseye
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Update system packages and install essential dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ python3 \
10
+ python3-pip \
11
+ curl \
12
+ git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Update npm to latest version
16
+ RUN npm install -g npm@latest
17
+
18
+ # Install n8n globally with specific version for stability
19
+ RUN npm install -g n8n@latest
20
+
21
+ # Expose the required port for Hugging Face Spaces
22
+ EXPOSE 7860
23
+
24
+ # Set environment variables for n8n on Hugging Face Spaces
25
+ ENV PORT=7860 \
26
+ N8N_HOST=0.0.0.0 \
27
+ N8N_PORT=7860 \
28
+ N8N_LISTEN_ADDRESS=0.0.0.0 \
29
+ N8N_PROTOCOL=https \
30
+ N8N_EDITOR_BASE_URL=https://chandrakant-s4-n8n-duplicate.hf.space \
31
+ WEBHOOK_URL=https://chandrakant-s4-n8n-duplicate.hf.space \
32
+ N8N_DISABLE_UI=false \
33
+ N8N_BASIC_AUTH_ACTIVE=false \
34
+ N8N_METRICS=false \
35
+ N8N_DIAGNOSTICS_ENABLED=false \
36
+ NODE_ENV=production \
37
+ N8N_RUNNERS_ENABLED=true
38
+
39
+ # Ensure n8n is installed and accessible
40
+ RUN which n8n
41
+
42
+ # Add periodic API call script (runs in the background)
43
+ RUN echo '#!/bin/sh\nwhile true; do curl -s https://chandrakant-s4-n8n-duplicate.hf.space/; sleep 43200; done &' > /periodic.sh \
44
+ && chmod +x /periodic.sh
45
+
46
+ # Start periodic API call and n8n
47
+ CMD ["/bin/sh", "-c", "/periodic.sh & exec n8n"]