| FROM n8nio/n8n:latest | |
| USER root | |
| # 1. تثبيت أداة Cloudflare | |
| RUN apk add --no-cache wget ca-certificates | |
| RUN wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /usr/local/bin/cloudflared && \ | |
| chmod +x /usr/local/bin/cloudflared | |
| # 2. إعداد ملف التشغيل (تأكد أن اسمه start.sh في الـ Space) | |
| COPY start.sh /start.sh | |
| RUN chmod +x /start.sh && chown node:node /start.sh | |
| # 3. إعدادات المنفذ والمتغيرات | |
| ENV N8N_PORT=7860 | |
| ENV N8N_PROTOCOL=https | |
| # 4. العودة للمستخدم node (إجباري في الصور الحديثة لـ n8n) | |
| USER node | |
| # 5. التشغيل باستخدام التنسيق ده (لضمان التقاط الـ Secrets) | |
| ENTRYPOINT ["/bin/sh", "/start.sh"] |