Spaces:
Runtime error
Runtime error
| FROM node:18-alpine | |
| # 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 | |
| ARG N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=$N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS | |
| ARG N8N_HOST=$N8N_HOST | |
| ARG N8N_PORT=$N8N_PORT | |
| ARG N8N_PROTOCOL=https | |
| ARG N8N_EDITOR_BASE_URL=$N8N_EDITOR_BASE_URL | |
| ARG WEBHOOK_URL=$WEBHOOK_URL | |
| ARG GENERIC_TIMEZONE=$GENERIC_TIMEZONE | |
| ARG TZ=$TZ | |
| ARG N8N_ENCRYPTION_KEY=$N8N_ENCRYPTION_KEY | |
| ARG DB_TYPE=$DB_TYPE | |
| ARG DB_POSTGRESDB_SCHEMA=$DB_POSTGRESDB_SCHEMA | |
| ARG DB_POSTGRESDB_HOST=$DB_POSTGRESDB_HOST | |
| ARG DB_POSTGRESDB_DATABASE=$DB_POSTGRESDB_DATABASE | |
| ARG DB_POSTGRESDB_PORT=$DB_POSTGRESDB_PORT | |
| ARG DB_POSTGRESDB_USER=$DB_POSTGRESDB_USER | |
| ARG DB_POSTGRESDB_PASSWORD=$DB_POSTGRESDB_PASSWORD | |
| # Install system dependencies | |
| RUN apk add --no-cache git python3 py3-pip make g++ build-base cairo-dev pango-dev chromium postgresql-client ffmpeg fontconfig font-dejavu yt-dlp | |
| # Install custom fonts | |
| RUN mkdir -p /usr/share/fonts/truetype/custom | |
| COPY ./fonts/HanyiSentyPagoda_Regular.ttf /usr/share/fonts/truetype/custom/ | |
| RUN chmod 644 /usr/share/fonts/truetype/custom/HanyiSentyPagoda_Regular.ttf # 确保字体文件具有读取权限 | |
| RUN fc-cache -f -v | |
| # Set environment variables | |
| ENV PUPPETEER_SKIP_DOWNLOAD=true | |
| ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser | |
| # Install n8n globally | |
| RUN npm install -g [email protected] | |
| # Create necessary directories | |
| RUN mkdir -p $DATABASE_PATH $CONFIG_PATH $WORKFLOWS_PATH $LOGS_PATH | |
| # Chown the directories to the n8n user (if n8n has a specific user) | |
| # If n8n doesn't have a specific user, you can remove this section | |
| RUN addgroup -g 1000 n8n && \ | |
| adduser -u 1000 -G n8n -s /bin/sh -D n8n | |
| RUN chown -R n8n:n8n $BASE_PATH | |
| # Switch to the n8n user. If n8n doesn't have a user, remove this. | |
| USER n8n | |
| # Set working directory | |
| WORKDIR /data | |
| # Start n8n | |
| CMD ["n8n", "start"] | |