FROM node:20-bookworm USER root RUN apt-get update && apt-get install -y --no-install-recommends \ postgresql \ postgresql-client \ supervisor \ curl \ python3 \ python3-pip \ git \ make \ g++ \ ffmpeg \ graphicsmagick \ dumb-init \ openssl \ && rm -rf /var/lib/apt/lists/* RUN pip3 install yt-dlp huggingface_hub --break-system-packages RUN npm install -g n8n@latest ENV N8N_PORT=7860 ENV N8N_PROTOCOL=https ENV WEBHOOK_URL="" ENV N8N_LOG_OUTPUT=console ENV NODE_FUNCTION_ALLOW_BUILTIN=* ENV NODE_FUNCTION_ALLOW_EXTERNAL=* ENV NODE_OPTIONS="--max-old-space-size=4096" ENV N8N_SECURE_COOKIE=false ENV DB_TYPE=postgresdb ENV DB_POSTGRESDB_HOST=localhost ENV DB_POSTGRESDB_PORT=5432 ENV DB_POSTGRESDB_DATABASE=n8n ENV DB_POSTGRESDB_USER=n8n ENV DB_POSTGRESDB_PASSWORD=n8n_secret ENV N8N_USER_FOLDER=/data/n8n ENV N8N_ENCRYPTION_KEY=change-me-to-a-random-string ENV PGDATA=/data/postgres ENV KEEP_ALIVE_INTERVAL=300 ENV BACKUP_INTERVAL=300 EXPOSE 7860 RUN mkdir -p /data/n8n /data/postgres /data/backups /var/log/supervisor COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY entrypoint.sh /entrypoint.sh COPY backup.sh /backup.sh RUN chmod +x /entrypoint.sh /backup.sh ENTRYPOINT ["dumb-init", "--"] CMD ["/entrypoint.sh"]