aproxtimedev commited on
Commit
0db841e
·
verified ·
1 Parent(s): 1163eda

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +98 -0
  2. nginx.conf +53 -0
  3. start.sh +15 -0
Dockerfile ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:24-alpine
2
+
3
+ USER root
4
+
5
+ RUN apk update
6
+ # Install system dependencies
7
+ RUN apk add --no-cache \
8
+ git \
9
+ python3 \
10
+ py3-pip \
11
+ make \
12
+ g++ \
13
+ build-base \
14
+ cairo-dev \
15
+ pango-dev \
16
+ chromium \
17
+ postgresql-client \
18
+ ffmpeg \
19
+ yt-dlp \
20
+ openssl \
21
+ curl \
22
+ wget \
23
+ shadow \
24
+ nginx
25
+
26
+ RUN npm install -g n8n@1.103.2
27
+
28
+ RUN mkdir -p /var/cache/nginx \
29
+ /var/log/nginx \
30
+ /var/lib/nginx
31
+
32
+ RUN touch /var/run/nginx.pid
33
+
34
+ RUN mkdir -p /run/nginx
35
+
36
+ RUN touch /run/nginx/nginx.pid
37
+
38
+ RUN chown -R node:node /var/cache/nginx \
39
+ /var/log/nginx \
40
+ /var/lib/nginx \
41
+ /var/run/nginx.pid \
42
+ /run/nginx/nginx.pid
43
+
44
+ # Set user to node for installation
45
+ USER node
46
+ # Arguments that can be passed at build time
47
+ ARG N8N_PATH=/usr/local/lib/node_modules/n8n
48
+ ARG BASE_PATH=/home/user/.n8n
49
+ ARG N8N_USER_FOLDER=$BASE_PATH
50
+ ARG DATABASE_PATH=$BASE_PATH/database
51
+ ARG CONFIG_PATH=$BASE_PATH/config
52
+ ARG WORKFLOWS_PATH=$BASE_PATH/workflows
53
+ ARG LOGS_PATH=$BASE_PATH/logs
54
+ ARG N8N_HOST=$N8N_HOST
55
+ ARG N8N_EDITOR_BASE_URL=https://$N8N_HOST
56
+ ARG WEBHOOK_URL=$WEBHOOK_URL
57
+ ARG GENERIC_TIMEZONE="Asia/Jakarta"
58
+ ARG TZ="Asia/Jakarta"
59
+
60
+ # Set environment variables
61
+ ENV PUPPETEER_SKIP_DOWNLOAD=true
62
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
63
+
64
+ # Install n8n globally
65
+ WORKDIR /home/user
66
+
67
+ RUN wget https://github.com/glotlabs/gdrive/releases/download/3.9.1/gdrive_linux-x64.tar.gz -O gdrive.tar.gz
68
+
69
+ RUN tar -xzf gdrive.tar.gz
70
+
71
+ RUN chmod +x gdrive
72
+
73
+ # Create necessary directories
74
+ RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH \
75
+ && chmod -R 777 $BASE_PATH
76
+
77
+ ENV HOME=/home/user
78
+
79
+ COPY --chown=node nginx.conf /etc/nginx/nginx.conf
80
+
81
+ WORKDIR $HOME/app
82
+
83
+ COPY --chown=node start.sh .
84
+
85
+ RUN chmod +x start.sh
86
+
87
+ RUN mkdir /home/user/app/shared-direct-files
88
+
89
+ # Set owner
90
+ RUN chown -R node:node /home/user/
91
+
92
+ # Set working directory
93
+ WORKDIR /data
94
+
95
+ EXPOSE 7860
96
+
97
+ # Start n8n
98
+ CMD ["/home/user/app/start.sh"]
nginx.conf ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {}
2
+
3
+ http {
4
+ access_log off;
5
+ error_log /dev/null crit;
6
+
7
+ map $http_upgrade $http_connection {
8
+ default upgrade;
9
+ '' close;
10
+ }
11
+
12
+ server {
13
+ listen 7860;
14
+
15
+ location = /shared-direct-files/ {
16
+ alias /home/user/app/shared-direct-files/;
17
+ autoindex on;
18
+ access_log off;
19
+ }
20
+
21
+ # Serve files (and trigger download)
22
+ location /shared-direct-files/ {
23
+ alias /home/user/app/shared-direct-files/;
24
+ access_log off;
25
+ default_type application/octet-stream;
26
+ add_header Content-Disposition 'attachment';
27
+ }
28
+
29
+ # WebSocket path for N8N
30
+ location /rest/push {
31
+ proxy_pass http://127.0.0.1:5678;
32
+
33
+ proxy_http_version 1.1;
34
+ proxy_set_header Upgrade $http_upgrade;
35
+ proxy_set_header Connection $http_connection;
36
+ proxy_set_header Host $host;
37
+
38
+ proxy_set_header X-Real-IP $remote_addr;
39
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
40
+ proxy_set_header X-Forwarded-Proto $scheme;
41
+ }
42
+
43
+ # Default proxy to N8N
44
+ location / {
45
+ proxy_pass http://127.0.0.1:5678;
46
+ proxy_http_version 1.1;
47
+ proxy_set_header Host $host;
48
+ proxy_set_header X-Real-IP $remote_addr;
49
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
50
+ proxy_set_header X-Forwarded-Proto $scheme;
51
+ }
52
+ }
53
+ }
start.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ cd ~/
4
+
5
+ wget $N8N_TAR -O n8n.tar.gz
6
+ tar -xzf n8n.tar.gz
7
+
8
+ n8n start --user=folder=$N8N_USER_FOLDER &
9
+
10
+ # sleep 10
11
+
12
+ # cd ~/.n8n/nodes && npm install @telepilotco/n8n-nodes-telepilot
13
+
14
+ # Start Nginx in foreground (so container stays alive)
15
+ nginx -g "daemon off;"