legends810 commited on
Commit
d18e153
·
verified ·
1 Parent(s): 909f201

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -25
Dockerfile CHANGED
@@ -1,40 +1,44 @@
1
  ###############################################################################
2
- # n8n for Hugging Face Spaces – fixed public-URL handling (no bash needed)
3
  ###############################################################################
4
  FROM docker.n8n.io/n8nio/n8n:latest
5
 
6
- ENV N8N_LOG_LEVEL=debug
7
-
8
- #################### Runtime env vars #########################################
9
  ENV N8N_HOST=0.0.0.0 \
10
  N8N_PROTOCOL=http \
11
  DB_TYPE=sqlite \
12
  DB_SQLITE_DATABASE=/home/node/.n8n/database.sqlite \
13
  N8N_COMMUNITY_PACKAGES_ENABLED=true \
 
14
  N8N_DISABLE_PRODUCTION_MAIN_PROCESS_RESPONSE_COMPRESSION=true \
15
  N8N_DISABLE_PRODUCTION_WEBHOOK_RESPONSE_COMPRESSION=true \
16
  N8N_BASIC_AUTH_ACTIVE=false \
17
  N8N_USER_MANAGEMENT_DISABLED=true \
18
- N8N_LOG_LEVEL=info
 
 
 
 
 
 
 
 
19
 
20
- #################### Start script #############################################
21
  USER root
22
  RUN set -e; \
23
  cat >/usr/local/bin/start.sh <<'SH' && \
24
  chmod +x /usr/local/bin/start.sh
25
  #!/bin/sh
26
  set -eu
27
-
28
- # HF reverse-proxy sets $PORT (local fallback 7860)
29
  N8N_PORT="${PORT:-7860}"
30
  export N8N_PORT
31
 
32
- # ---- build public URL ------------------------------------------------------
33
  if [ -n "${SPACE_ID:-}" ]; then
34
- # convert "user/repo" → "user-repo"
35
  SPACE_SLUG=$(printf '%s' "$SPACE_ID" | tr '/_' '-')
36
  APP_URL="https://${SPACE_SLUG}.hf.space"
37
- elif [ -n "${SPACE_HOST:-}" ]; then # legacy var
38
  APP_URL="https://${SPACE_HOST}"
39
  elif [ -n "${HOSTNAME:-}" ] && echo "$HOSTNAME" | grep -q '\.hf\.space'; then
40
  APP_URL="https://${HOSTNAME}"
@@ -42,29 +46,19 @@ else
42
  APP_URL="http://localhost:${N8N_PORT}"
43
  fi
44
 
45
- export N8N_BASE_URL="${APP_URL}/"
46
- export WEBHOOK_URL="${APP_URL}/"
 
47
  export N8N_EDITOR_BASE_URL="${APP_URL}"
48
 
49
- echo "🚀 n8n starting on port ${N8N_PORT}"
50
- echo "🌐 Public URL : ${APP_URL}"
51
- echo "📚 DB : SQLite"
52
- echo "🔒 Authentication : disabled"
53
- echo "📦 Community packages: enabled"
54
- echo "🗜️ Compression : disabled"
55
- echo
56
-
57
  exec n8n start
58
  SH
59
  USER node
60
 
61
- #################### (optional) expose port ###################################
62
  EXPOSE 7860
63
-
64
- #################### health-check #############################################
65
  HEALTHCHECK --interval=30s --timeout=10s --start-period=45s --retries=3 \
66
  CMD sh -c 'curl -f http://localhost:${PORT:-7860}/healthz || exit 1'
67
 
68
- #################### entrypoint ################################################
69
  ENTRYPOINT ["tini", "--"]
70
  CMD ["start.sh"]
 
1
  ###############################################################################
2
+ # n8n for Hugging Face Spaces – gzip fully disabled via custom extension
3
  ###############################################################################
4
  FROM docker.n8n.io/n8nio/n8n:latest
5
 
6
+ ################ Runtime env vars #############################################
 
 
7
  ENV N8N_HOST=0.0.0.0 \
8
  N8N_PROTOCOL=http \
9
  DB_TYPE=sqlite \
10
  DB_SQLITE_DATABASE=/home/node/.n8n/database.sqlite \
11
  N8N_COMMUNITY_PACKAGES_ENABLED=true \
12
+ # नीचे वाले flag रहने दीजिये – पर अब JS extension भी लगेगा
13
  N8N_DISABLE_PRODUCTION_MAIN_PROCESS_RESPONSE_COMPRESSION=true \
14
  N8N_DISABLE_PRODUCTION_WEBHOOK_RESPONSE_COMPRESSION=true \
15
  N8N_BASIC_AUTH_ACTIVE=false \
16
  N8N_USER_MANAGEMENT_DISABLED=true \
17
+ N8N_LOG_LEVEL=info \
18
+ # ➜ custom extension path
19
+ N8N_CUSTOM_EXTENSIONS=/home/node/n8n-custom
20
+
21
+ ################ Copy custom extension ########################################
22
+ USER node
23
+ RUN mkdir -p /home/node/n8n-custom
24
+ # JS file repo में जिस path पर है वही copy करें
25
+ COPY n8n-custom/disableCompression.js /home/node/n8n-custom/
26
 
27
+ ################ Start script ##################################################
28
  USER root
29
  RUN set -e; \
30
  cat >/usr/local/bin/start.sh <<'SH' && \
31
  chmod +x /usr/local/bin/start.sh
32
  #!/bin/sh
33
  set -eu
 
 
34
  N8N_PORT="${PORT:-7860}"
35
  export N8N_PORT
36
 
37
+ # ----- build public URL ------------------------------------------------------
38
  if [ -n "${SPACE_ID:-}" ]; then
 
39
  SPACE_SLUG=$(printf '%s' "$SPACE_ID" | tr '/_' '-')
40
  APP_URL="https://${SPACE_SLUG}.hf.space"
41
+ elif [ -n "${SPACE_HOST:-}" ]; then
42
  APP_URL="https://${SPACE_HOST}"
43
  elif [ -n "${HOSTNAME:-}" ] && echo "$HOSTNAME" | grep -q '\.hf\.space'; then
44
  APP_URL="https://${HOSTNAME}"
 
46
  APP_URL="http://localhost:${N8N_PORT}"
47
  fi
48
 
49
+ # NOTE: trailing slash हटाया है ताकि double-slash न बने
50
+ export N8N_BASE_URL="${APP_URL}"
51
+ export WEBHOOK_URL="${APP_URL}"
52
  export N8N_EDITOR_BASE_URL="${APP_URL}"
53
 
54
+ echo "🚀 n8n starting on ${N8N_PORT} | Public URL: ${APP_URL}"
 
 
 
 
 
 
 
55
  exec n8n start
56
  SH
57
  USER node
58
 
 
59
  EXPOSE 7860
 
 
60
  HEALTHCHECK --interval=30s --timeout=10s --start-period=45s --retries=3 \
61
  CMD sh -c 'curl -f http://localhost:${PORT:-7860}/healthz || exit 1'
62
 
 
63
  ENTRYPOINT ["tini", "--"]
64
  CMD ["start.sh"]