# Dockerfile n8n + SANS CACHE TTS (VERSION NEUTRE STABLE) #by Dieu Merci Mvemba # 1. Image de base Debian Bookworm (12) FROM debian:bookworm-slim # Définir le répertoire de travail WORKDIR /usr/local/n8n # Installer les dépendances système (apt-get) USER root RUN apt-get update && apt-get install -y --no-install-recommends \ git \ build-essential \ curl \ ffmpeg \ libopenblas-dev \ libasound2 \ libsndfile1 \ python3 \ python3-pip \ postgresql-client \ chromium \ libnss3 \ libxtst6 \ libpangocairo-1.0-0 \ libxcomposite1 \ libxi6 \ libatk-bridge2.0-0 \ libgbm-dev \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # AJOUT CRITIQUE : Installation de Node.js v20 (pour n8n) RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs # Installer N8N (LATEST) RUN npm install -g n8n@latest RUN npm install -g @n8n/n8n-nodes-langchain@latest RUN npm install -g n8n-nodes-ffmpeg@latest # FIX: éviter le doublon de @n8n/n8n-nodes-langchain chargé 2 fois # (supprime la copie imbriquée sous n8n si elle existe) RUN rm -rf /usr/lib/node_modules/n8n/node_modules/@n8n/n8n-nodes-langchain || true # Créer l'utilisateur 'node' et changer le propriétaire RUN adduser --disabled-password --gecos "" node \ && chown -R node:node /usr/local/n8n # --- INSTALLATIONS CRITIQUES POUR L'IA AUDIO (TTS et Whisper) + yt-dlp --- # 1. Mise à jour de pip/setuptools (AVEC FIX PEP 668) RUN python3 -m pip install --break-system-packages --upgrade pip setuptools wheel # 2. Installation des librairies Python AI (AVEC FIX PEP 668) RUN python3 -m pip install --break-system-packages \ torch \ transformers \ accelerate \ soundfile \ openai-whisper \ stable-ts \ numpy \ yt-dlp \ TTS # --- FIN DES INSTALLATIONS (PAS DE CACHE TTS) --- # 3. CRUCIAL : Copie des fichiers et ajustement des permissions COPY data/ /data/ RUN chown -R node:node /data USER node # 4. Variables d'environnement ENV N8N_HOST=0.0.0.0 ENV N8N_PORT=7860 ENV N8N_PROTOCOL=https ENV GENERIC_TIMEZONE=Africa/Kinshasa ENV TZ=Africa/Kinshasa ENV N8N_ENCRYPTION_KEY=a_secret_key_to_be_replaced ENV N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true ENV N8N_EXPRESS_SERVER_SET_PROXY_HOST=true ENV N8N_GIT_NODE_DISABLE_BARE_REPOS=true ENV N8N_BASIC_AUTH_ACTIVE=true ENV WEBHOOK_URL=https://-.hf.space/ ENV N8N_EDITOR_BASE_URL=https://-.hf.space/ ENV allowVulnerableTags=true ENV DB_TYPE=postgresdb ENV DB_POSTGRESDB_HOST=localhost ENV DB_POSTGRESDB_DATABASE=n8n ENV DB_POSTGRESDB_USER=user ENV DB_POSTGRESDB_PASSWORD=motdepasse ENV DB_POSTGRESDB_PORT=5432 ENV NODE_FUNCTION_ALLOW_BUILTIN=* ENV NODE_FUNCTION_ALLOW_EXTERNAL=* ENV PUPPETEER_SKIP_DOWNLOAD=true ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium ENV N8N_DATA_FOLDER=/data # Définir répertoire de travail WORKDIR /data # Expose le port pour Hugging Face Spaces EXPOSE 7860 # Lancer n8n (exécuté par l'utilisateur 'node') CMD ["n8n", "start", "--port", "7860"]