File size: 1,259 Bytes
f0f7430
37ec2e4
b5df2e4
 
b4f0166
b5df2e4
 
 
 
 
 
 
37ec2e4
b5df2e4
 
 
 
 
 
 
 
 
 
 
 
 
b4f0166
 
37ec2e4
b4f0166
b5df2e4
 
37ec2e4
b4f0166
 
 
 
 
 
f0f7430
 
37ec2e4
b5df2e4
 
 
37ec2e4
b5df2e4
 
37ec2e4
b4f0166
 
 
 
 
b5df2e4
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
FROM node:20-alpine

# Set user to root for installation
USER root

# Arguments that can be passed at build time
ARG N8N_PATH=/usr/local/lib/node_modules/n8n
ARG BASE_PATH=/root/.n8n
ARG DATABASE_PATH=$BASE_PATH/database
ARG CONFIG_PATH=$BASE_PATH/config
ARG WORKFLOWS_PATH=$BASE_PATH/workflows
ARG LOGS_PATH=$BASE_PATH/logs

# Install system dependencies
RUN apk add --no-cache \
    git \
    python3 \
    py3-pip \
    make \
    g++ \
    build-base \
    cairo-dev \
    pango-dev \
    chromium \
    postgresql-client \
    ffmpeg \
    yt-dlp \
    tini

# Set environment variables for Puppeteer
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

# Set n8n environment variables for Hugging Face Spaces
ENV N8N_HOST=0.0.0.0
ENV N8N_PORT=7860
ENV N8N_PROTOCOL=https
ENV N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true

# Install n8n globally (using LTS version for stability)
RUN npm install -g n8n@latest

# Create necessary directories
RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH \
    && chmod -R 777 $BASE_PATH

# Set working directory
WORKDIR /data

# Expose port for Hugging Face Spaces
EXPOSE 7860

# Use tini as init system and start n8n
ENTRYPOINT ["tini", "--"]
CMD ["n8n", "start"]