Heuehneje commited on
Commit
3cc52ba
·
verified ·
1 Parent(s): d734a94

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +19 -13
  2. start.sh +20 -0
Dockerfile CHANGED
@@ -1,26 +1,32 @@
1
  FROM node:18.17.0-alpine
2
 
 
 
 
3
  # Create app directory
4
  WORKDIR /usr/src/app
5
 
6
  # Install n8n
7
  RUN npm install -g n8n
8
 
 
 
 
9
  # Expose the default n8n port
10
  EXPOSE 5678
11
 
12
- # Set environment variables from Hugging Face secrets
13
- ENV N8N_BASIC_AUTH_ACTIVE=true
14
- ENV N8N_BASIC_AUTH_USER=${N8N_USER}
15
- ENV N8N_BASIC_AUTH_PASSWORD=${N8N_PASSWORD}
16
-
17
- # Add health check and debugging
18
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
19
- CMD curl -f http://localhost:5678/healthz || exit 1
20
 
21
- # Print environment variables for debugging
22
- RUN echo "N8N_USER: ${N8N_USER}" && \
23
- echo "N8N_PASSWORD: ${N8N_PASSWORD}"
24
 
25
- # Set the entrypoint
26
- ENTRYPOINT ["n8n"]
 
 
 
1
  FROM node:18.17.0-alpine
2
 
3
+ # Install PostgreSQL client and dependencies
4
+ RUN apk add --no-cache postgresql-client python3 py3-pip
5
+
6
  # Create app directory
7
  WORKDIR /usr/src/app
8
 
9
  # Install n8n
10
  RUN npm install -g n8n
11
 
12
+ # Install pyngrok
13
+ RUN pip3 install pyngrok
14
+
15
  # Expose the default n8n port
16
  EXPOSE 5678
17
 
18
+ # Set environment variables for database
19
+ ENV DB_TYPE=postgresdb
20
+ ENV DB_POSTGRESDB_DATABASE=n8n
21
+ ENV DB_POSTGRESDB_HOST=postgres
22
+ ENV DB_POSTGRESDB_PORT=5432
23
+ ENV DB_POSTGRESDB_USER=n8n
24
+ ENV DB_POSTGRESDB_PASSWORD=n8n_password
 
25
 
26
+ # Set ngrok auth token
27
+ ENV NGROK_AUTH_TOKEN="2jxZvrHacdbj09XoGdETb9TDjuu_4S4KHwtFYw4jhNPuymvR7"
 
28
 
29
+ # Set the entrypoint to start n8n and ngrok
30
+ COPY start.sh /usr/src/app/start.sh
31
+ RUN chmod +x /usr/src/app/start.sh
32
+ ENTRYPOINT ["/usr/src/app/start.sh"]
start.sh ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ # Start n8n in the background
4
+ n8n &
5
+
6
+ # Set ngrok auth token
7
+ ngrok authtoken $NGROK_AUTH_TOKEN
8
+
9
+ # Create ngrok tunnel to n8n port
10
+ ngrok http 5678 &
11
+
12
+ # Wait for ngrok to initialize
13
+ sleep 5
14
+
15
+ # Print the public URL
16
+ echo "n8n is now accessible at:"
17
+ curl -s localhost:4040/api/tunnels | jq -r '.tunnels[0].public_url'
18
+
19
+ # Keep container running
20
+ wait