legends810 commited on
Commit
18e75aa
Β·
verified Β·
1 Parent(s): e9c25c2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -16
Dockerfile CHANGED
@@ -1,10 +1,9 @@
1
  ###############################################################################
2
- # n8n for Hugging Face Spaces – single-file Docker recipe
3
  ###############################################################################
4
  FROM docker.n8n.io/n8nio/n8n:latest
5
 
6
- ########## Runtime-level env vars #############################################
7
- # HF reverse-proxy ΰ€¦ΰ₯‡ΰ€—ΰ€Ύ $PORT; 7860 fallback local dev ΰ€•ΰ₯‡ ΰ€²ΰ€Ώΰ€
8
  ENV N8N_HOST=0.0.0.0 \
9
  N8N_PROTOCOL=http \
10
  DB_TYPE=sqlite \
@@ -15,16 +14,19 @@ ENV N8N_HOST=0.0.0.0 \
15
  N8N_USER_MANAGEMENT_DISABLED=true \
16
  N8N_LOG_LEVEL=info
17
 
18
- ########## create tiny start script inside the image ##########################
19
  USER root
20
- RUN cat >/usr/local/bin/start.sh <<'SCRIPT' && \
 
21
  chmod +x /usr/local/bin/start.sh
22
  #!/bin/sh
23
- set -e
24
 
25
- export N8N_PORT="${PORT:-7860}"
 
 
26
 
27
- # figure out public URL for webhooks/editor
28
  if [ -n "${SPACE_ID:-}" ]; then
29
  APP_URL="https://${SPACE_ID}.hf.space"
30
  elif [ -n "${SPACE_HOST:-}" ]; then
@@ -37,7 +39,7 @@ export N8N_BASE_URL="${APP_URL}/"
37
  export WEBHOOK_URL="${APP_URL}/"
38
  export N8N_EDITOR_BASE_URL="${APP_URL}"
39
 
40
- echo "πŸš€ n8n is starting on port ${N8N_PORT}"
41
  echo "🌐 Public URL : ${APP_URL}"
42
  echo "πŸ“š DB : SQLite"
43
  echo "πŸ”’ Authentication : disabled"
@@ -45,18 +47,17 @@ echo "πŸ“¦ Community packages: enabled"
45
  echo "πŸ—œοΈ Compression : disabled"
46
  echo
47
 
48
- exec su-exec node n8n start
49
- SCRIPT
50
-
51
  USER node
52
 
53
- ########## (optional) expose default port #####################################
54
  EXPOSE 7860
55
 
56
- ########## healthcheck ########################################################
57
  HEALTHCHECK --interval=30s --timeout=10s --start-period=45s --retries=3 \
58
- CMD curl -f http://localhost:${PORT:-7860}/healthz || exit 1
59
 
60
- ########## container entrypoint ###############################################
61
  ENTRYPOINT ["tini", "--"]
62
  CMD ["start.sh"]
 
1
  ###############################################################################
2
+ # n8n for Hugging Face Spaces – bash-less, single-file Docker recipe
3
  ###############################################################################
4
  FROM docker.n8n.io/n8nio/n8n:latest
5
 
6
+ #################### Runtime-level env vars ###################################
 
7
  ENV N8N_HOST=0.0.0.0 \
8
  N8N_PROTOCOL=http \
9
  DB_TYPE=sqlite \
 
14
  N8N_USER_MANAGEMENT_DISABLED=true \
15
  N8N_LOG_LEVEL=info
16
 
17
+ #################### Tiny start script ########################################
18
  USER root
19
+ RUN set -e; \
20
+ cat >/usr/local/bin/start.sh <<'SH' && \
21
  chmod +x /usr/local/bin/start.sh
22
  #!/bin/sh
23
+ set -eu
24
 
25
+ # HF reverse-proxy sets $PORT; fallback 7860 for local runs
26
+ N8N_PORT="${PORT:-7860}"
27
+ export N8N_PORT
28
 
29
+ # Public URL for webhooks / editor
30
  if [ -n "${SPACE_ID:-}" ]; then
31
  APP_URL="https://${SPACE_ID}.hf.space"
32
  elif [ -n "${SPACE_HOST:-}" ]; then
 
39
  export WEBHOOK_URL="${APP_URL}/"
40
  export N8N_EDITOR_BASE_URL="${APP_URL}"
41
 
42
+ echo "πŸš€ n8n starting on port ${N8N_PORT}"
43
  echo "🌐 Public URL : ${APP_URL}"
44
  echo "πŸ“š DB : SQLite"
45
  echo "πŸ”’ Authentication : disabled"
 
47
  echo "πŸ—œοΈ Compression : disabled"
48
  echo
49
 
50
+ exec n8n start
51
+ SH
 
52
  USER node
53
 
54
+ #################### (optional) expose default port ###########################
55
  EXPOSE 7860
56
 
57
+ #################### health-check #############################################
58
  HEALTHCHECK --interval=30s --timeout=10s --start-period=45s --retries=3 \
59
+ CMD sh -c 'curl -f http://localhost:${PORT:-7860}/healthz || exit 1'
60
 
61
+ #################### container entrypoint #####################################
62
  ENTRYPOINT ["tini", "--"]
63
  CMD ["start.sh"]