srinuksv commited on
Commit
9afb3ea
·
verified ·
1 Parent(s): 8f7dce8

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Node.js image as the base image
2
+ FROM node:20-alpine
3
+
4
+ # Set environment variables for n8n
5
+ ENV N8N_VERSION=1.16.0 \
6
+ N8N_USER=n8n \
7
+ N8N_HOME=/home/n8n
8
+
9
+ # Create a non-root user
10
+ RUN addgroup -S $N8N_USER && adduser -S $N8N_USER -G $N8N_USER
11
+
12
+ # Create a working directory
13
+ WORKDIR $N8N_HOME
14
+
15
+ # Install dependencies
16
+ RUN apk add --no-cache \
17
+ bash \
18
+ tini \
19
+ python3 \
20
+ py3-pip \
21
+ libc6-compat \
22
+ openssh-client \
23
+ curl \
24
+ git
25
+
26
+ # Install n8n globally
27
+ RUN npm install -g n8n@$N8N_VERSION
28
+
29
+ # Change ownership to the n8n user
30
+ RUN chown -R $N8N_USER:$N8N_USER $N8N_HOME
31
+
32
+ # Switch to the non-root user
33
+ USER $N8N_USER
34
+
35
+ # Expose the default n8n port
36
+ EXPOSE 5678
37
+
38
+ # Use tini to handle process signals correctly
39
+ ENTRYPOINT ["tini", "--"]
40
+
41
+ # Start n8n with authentication from environment variables
42
+ CMD ["n8n"]