File size: 2,059 Bytes
bd22336
18e75aa
bd22336
bef4e0a
9a13398
18e75aa
bd22336
 
 
 
 
 
 
 
 
bef4e0a
18e75aa
bd22336
18e75aa
 
bd22336
e9c25c2
18e75aa
bd22336
18e75aa
 
 
bd22336
18e75aa
bd22336
 
e9c25c2
bd22336
0f57f8d
bd22336
0f57f8d
 
283e7af
 
 
 
18e75aa
bd22336
 
 
 
 
 
283e7af
18e75aa
 
bd22336
283e7af
18e75aa
9a13398
 
18e75aa
283e7af
18e75aa
9a13398
18e75aa
283e7af
bd22336
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
###############################################################################
# n8n for Hugging Face Spaces – bash-less, single-file Docker recipe
###############################################################################
FROM docker.n8n.io/n8nio/n8n:latest

#################### Runtime-level env vars ###################################
ENV N8N_HOST=0.0.0.0 \
    N8N_PROTOCOL=http \
    DB_TYPE=sqlite \
    DB_SQLITE_DATABASE=/home/node/.n8n/database.sqlite \
    N8N_COMMUNITY_PACKAGES_ENABLED=true \
    N8N_DISABLE_PRODUCTION_MAIN_PROCESS_RESPONSE_COMPRESSION=true \
    N8N_BASIC_AUTH_ACTIVE=false \
    N8N_USER_MANAGEMENT_DISABLED=true \
    N8N_LOG_LEVEL=info

#################### Tiny start script ########################################
USER root
RUN set -e; \
    cat >/usr/local/bin/start.sh <<'SH' && \
    chmod +x /usr/local/bin/start.sh
#!/bin/sh
set -eu

# HF reverse-proxy sets $PORT; fallback 7860 for local runs
N8N_PORT="${PORT:-7860}"
export N8N_PORT

# Public URL for webhooks / editor
if [ -n "${SPACE_ID:-}" ]; then
  APP_URL="https://${SPACE_ID}.hf.space"
elif [ -n "${SPACE_HOST:-}" ]; then
  APP_URL="https://${SPACE_HOST}"
else
  APP_URL="http://localhost:${N8N_PORT}"
fi

export N8N_BASE_URL="${APP_URL}/"
export WEBHOOK_URL="${APP_URL}/"
export N8N_EDITOR_BASE_URL="${APP_URL}"

echo "πŸš€  n8n starting on port ${N8N_PORT}"
echo "🌐  Public URL        : ${APP_URL}"
echo "πŸ“š  DB                : SQLite"
echo "πŸ”’  Authentication    : disabled"
echo "πŸ“¦  Community packages: enabled"
echo "πŸ—œοΈ   Compression       : disabled"
echo

exec n8n start
SH
USER node

#################### (optional) expose default port ###########################
EXPOSE 7860

#################### health-check #############################################
HEALTHCHECK --interval=30s --timeout=10s --start-period=45s --retries=3 \
  CMD sh -c 'curl -f http://localhost:${PORT:-7860}/healthz || exit 1'

#################### container entrypoint #####################################
ENTRYPOINT ["tini", "--"]
CMD ["start.sh"]