legends810 commited on
Commit
420a1ba
Β·
verified Β·
1 Parent(s): 40d563a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -30
Dockerfile CHANGED
@@ -1,13 +1,6 @@
 
 
1
 
2
- ###############################################################################
3
- # n8n on Hugging-Face Spaces β€’ External Postgres edition (Neon/Supabase …)
4
- ###############################################################################
5
-
6
- # Use nightly tag for newest build (fresher than stable)
7
- FROM docker.n8n.io/n8nio/n8n:nightly
8
-
9
- # ────── Basic env ────────────────────────────────────────────────────────────
10
- # DB_TYPE and DATABASE_URL are set in Secrets tab, not redefining here.
11
  ENV N8N_HOST=0.0.0.0 \
12
  N8N_PROTOCOL=http \
13
  N8N_LOG_LEVEL=debug \
@@ -16,47 +9,34 @@ ENV N8N_HOST=0.0.0.0 \
16
  N8N_RUNNERS_ENABLED=true \
17
  N8N_VERSION=nightly
18
 
19
- # Debug: Track nightly version (comment on separate line)
20
-
21
- # ────── 1. preload script to stub compression ───────────────────────────────
22
  USER node
23
  RUN cat >/home/node/disable-gzip-preload.js <<'JS'
24
- /* Stub out 'compression' so Express never gzips */
25
  const Module = require('module');
26
- const realLoad = Module._load;
27
- Module._load = function (request, parent, isMain) {
28
- if (request === 'compression') {
29
- return () => (_req, _res, next) => next();
30
- }
31
- return realLoad.apply(this, arguments);
32
- };
33
- console.log('πŸ—œοΈ compression module stubbed – gzip disabled');
34
  JS
35
-
36
  ENV NODE_OPTIONS="--require=/home/node/disable-gzip-preload.js"
37
 
38
- # ────── 2. start script to resolve HF public URL ────────────────────────────
39
  USER root
40
  RUN cat >/usr/local/bin/start.sh <<'SH' && chmod +x /usr/local/bin/start.sh
41
  #!/usr/bin/env sh
42
  set -eu
43
  export N8N_PORT="${PORT:-7860}"
44
-
45
  if [ -n "${SPACE_ID:-}" ]; then
46
  APP_URL="https://$(echo "$SPACE_ID" | tr '/_' '-').hf.space"
47
  else
48
  APP_URL="http://localhost:${N8N_PORT}"
49
  fi
50
-
51
  export N8N_BASE_URL="$APP_URL"
52
  export WEBHOOK_URL="$APP_URL"
53
  export N8N_EDITOR_BASE_URL="$APP_URL"
54
-
55
- echo "πŸš€ n8n starting on $N8N_PORT β€’ Public URL: $APP_URL"
56
- echo "πŸ“¦ n8n version: $N8N_VERSION" # Debug: Print version
57
  exec n8n start
58
  SH
59
 
60
  EXPOSE 7860
61
- ENTRYPOINT ["tini", "--"]
62
- CMD ["start.sh"]
 
1
+ # syntax=docker/dockerfile:1.5
2
+ FROM --pull docker.n8n.io/n8nio/n8n:nightly
3
 
 
 
 
 
 
 
 
 
 
4
  ENV N8N_HOST=0.0.0.0 \
5
  N8N_PROTOCOL=http \
6
  N8N_LOG_LEVEL=debug \
 
9
  N8N_RUNNERS_ENABLED=true \
10
  N8N_VERSION=nightly
11
 
 
 
 
12
  USER node
13
  RUN cat >/home/node/disable-gzip-preload.js <<'JS'
 
14
  const Module = require('module');
15
+ const real = Module._load;
16
+ Module._load = (req,p,m) => req==='compression'
17
+ ? () => (_req,_res,next)=>next()
18
+ : real(req,p,m);
19
+ console.log('πŸ—œοΈ compression disabled');
 
 
 
20
  JS
 
21
  ENV NODE_OPTIONS="--require=/home/node/disable-gzip-preload.js"
22
 
 
23
  USER root
24
  RUN cat >/usr/local/bin/start.sh <<'SH' && chmod +x /usr/local/bin/start.sh
25
  #!/usr/bin/env sh
26
  set -eu
27
  export N8N_PORT="${PORT:-7860}"
 
28
  if [ -n "${SPACE_ID:-}" ]; then
29
  APP_URL="https://$(echo "$SPACE_ID" | tr '/_' '-').hf.space"
30
  else
31
  APP_URL="http://localhost:${N8N_PORT}"
32
  fi
 
33
  export N8N_BASE_URL="$APP_URL"
34
  export WEBHOOK_URL="$APP_URL"
35
  export N8N_EDITOR_BASE_URL="$APP_URL"
36
+ echo "πŸš€ n8n on $N8N_PORT – $APP_URL"
 
 
37
  exec n8n start
38
  SH
39
 
40
  EXPOSE 7860
41
+ ENTRYPOINT ["tini","--"]
42
+ CMD ["start.sh"]