bitsnaps commited on
Commit
10b8e2d
·
verified ·
1 Parent(s): 9593ec6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +56 -29
Dockerfile CHANGED
@@ -1,34 +1,61 @@
1
  FROM node:16-alpine
2
- ARG N8N_VERSION
3
 
4
- RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi
5
-
6
- # Update everything and install needed dependencies
7
- RUN apk add --update graphicsmagick tzdata git tini su-exec
8
-
9
- # Set a custom user to not have n8n run as root
10
  USER root
11
-
12
- # Install n8n and the packages it needs to build it correctly.
13
- RUN apk --update add --virtual build-dependencies python3 build-base ca-certificates && \
14
- npm config set python "$(which python3)" && \
15
- npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION} && \
16
- apk del build-dependencies \
17
- && rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root;
18
-
19
- # Install fonts
20
- RUN apk --no-cache add --virtual fonts msttcorefonts-installer fontconfig && \
21
- update-ms-fonts && \
22
- fc-cache -f && \
23
- apk del fonts && \
24
- find /usr/share/fonts/truetype/msttcorefonts/ -type l -exec unlink {} \; \
25
- && rm -rf /root /tmp/* /var/cache/apk/* && mkdir /root
26
-
27
- ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
28
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  WORKDIR /data
30
 
31
- COPY docker-entrypoint.sh /docker-entrypoint.sh
32
- ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
33
-
34
- EXPOSE 5678/tcp
 
1
  FROM node:16-alpine
 
2
 
3
+ # Set user to root for installation
 
 
 
 
 
4
  USER root
5
+ # Arguments that can be passed at build time
6
+ ARG N8N_PATH=/usr/local/lib/node_modules/n8n
7
+ ARG BASE_PATH=/root/.n8n
8
+ ARG DATABASE_PATH=$BASE_PATH/database
9
+ ARG CONFIG_PATH=$BASE_PATH/config
10
+ ARG WORKFLOWS_PATH=$BASE_PATH/workflows
11
+ ARG LOGS_PATH=$BASE_PATH/logs
12
+ ARG N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=$N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS
13
+ ARG N8N_RUNNERS_ENABLED=true
14
+ ARG allowVulnerableTags=true
15
+ ARG N8N_HOST=$N8N_HOST
16
+ ARG N8N_PORT=$N8N_PORT
17
+ ARG N8N_PROTOCOL=https
18
+ ARG N8N_EDITOR_BASE_URL=$N8N_EDITOR_BASE_URL
19
+ ARG WEBHOOK_URL=$WEBHOOK_URL
20
+ ARG GENERIC_TIMEZONE=$GENERIC_TIMEZONE
21
+ ARG TZ=$TZ
22
+ ARG N8N_ENCRYPTION_KEY=$N8N_ENCRYPTION_KEY
23
+ ARG DB_TYPE=$DB_TYPE
24
+ ARG DB_POSTGRESDB_SCHEMA=$DB_POSTGRESDB_SCHEMA
25
+ ARG DB_POSTGRESDB_HOST=$DB_POSTGRESDB_HOST
26
+ ARG DB_POSTGRESDB_DATABASE=$DB_POSTGRESDB_DATABASE
27
+ ARG DB_POSTGRESDB_PORT=$DB_POSTGRESDB_PORT
28
+ ARG DB_POSTGRESDB_USER=$DB_POSTGRESDB_USER
29
+ ARG DB_POSTGRESDB_PASSWORD=$DB_POSTGRESDB_PASSWORD
30
+
31
+ # Install system dependencies
32
+ RUN apk add --no-cache \
33
+ git \
34
+ python3 \
35
+ py3-pip \
36
+ make \
37
+ g++ \
38
+ build-base \
39
+ cairo-dev \
40
+ pango-dev \
41
+ chromium \
42
+ postgresql-client \
43
+ ffmpeg \
44
+ yt-dlp
45
+
46
+ # Set environment variables
47
+ ENV PUPPETEER_SKIP_DOWNLOAD=true
48
+ ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
49
+
50
+ # Install n8n globally
51
+ RUN npm install -g [email protected]
52
+
53
+ # Create necessary directories
54
+ RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH \
55
+ && chmod -R 777 $BASE_PATH
56
+
57
+ # Set working directory
58
  WORKDIR /data
59
 
60
+ # Start n8n
61
+ CMD ["n8n", "start"]