FROM node:20-alpine USER root # Install dependencies with fresh repository data RUN apk update && apk add --no-cache \ git python3 py3-pip make g++ build-base \ cairo-dev pango-dev chromium postgresql-client ffmpeg yt-dlp \ bind-tools curl ca-certificates && \ update-ca-certificates && \ apk del build-base make g++ # Clean up build dependencies ENV PUPPETEER_SKIP_DOWNLOAD=true ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser # Node.js DNS settings #ENV NODE_OPTIONS="--dns-result-order=ipv4first" # Avoid disabling TLS verification unless necessary # ENV NODE_TLS_REJECT_UNAUTHORIZED=0 # Enable n8n debug logging ENV N8N_LOG_LEVEL=debug # Install n8n RUN npm install -g n8n@1.103.2 # Set up n8n directories with secure permissions RUN mkdir -p /root/.n8n/database /root/.n8n/config /root/.n8n/workflows /root/.n8n/logs \ && chmod -R 777 /root/.n8n WORKDIR /data # Expose ports for Hugging Face Spaces EXPOSE 8080 EXPOSE 7860 # Add health check to debug DNS at runtime #HEALTHCHECK --interval=30s --timeout=3s \ # CMD curl -f https://api.telegram.org || exit 1 CMD ["n8n", "start"]