Dockerfile 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Stage 1: Install Chromium and dependencies in a full Alpine image
  2. FROM alpine:3.22 AS chromium-installer
  3. RUN apk add --no-cache \
  4. chromium \
  5. nss \
  6. freetype \
  7. freetype-dev \
  8. harfbuzz \
  9. ca-certificates \
  10. ttf-freefont \
  11. font-noto-emoji \
  12. wqy-zenhei
  13. # Stage 2: Copy Chromium and dependencies to the n8n runners image
  14. FROM n8nio/runners:latest
  15. USER root
  16. # Copy Chromium binary, libraries, and fonts from the installer stage
  17. COPY --from=chromium-installer /usr/bin/chromium /usr/bin/chromium
  18. COPY --from=chromium-installer /usr/lib/chromium/ /usr/lib/chromium/
  19. COPY --from=chromium-installer /usr/lib/libnss*.so* /usr/lib/
  20. COPY --from=chromium-installer /usr/lib/libfreetype*.so* /usr/lib/
  21. COPY --from=chromium-installer /usr/lib/libharfbuzz*.so* /usr/lib/
  22. COPY --from=chromium-installer /usr/share/fonts/ /usr/share/fonts/
  23. COPY --from=chromium-installer /etc/fonts/ /etc/fonts/
  24. # Install JavaScript packages for utilities and scraping
  25. RUN cd /opt/runners/task-runner-javascript && \
  26. pnpm add moment uuid lodash dotenv axios got node-fetch puppeteer playwright cheerio jsdom xml2js jsonpath yaml form-data
  27. # Configure Playwright to use system Chromium instead of downloading browsers
  28. # This is necessary because Playwright's bundled browsers don't work well with Alpine's musl libc
  29. ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
  30. ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
  31. # Install Python packages for utilities and scraping
  32. RUN cd /opt/runners/task-runner-python && \
  33. uv pip install requests httpx aiohttp beautifulsoup4 lxml lxml[html_clean] selenium scrapy requests-html mechanize pyquery html5lib cssselect parsel pandas numpy jsonpath-ng pyyaml toml python-dotenv environs python-dateutil arrow pytz pendulum validators email-validator phonenumbers iso8601 websocket-client sickle selenium
  34. # Copy the launcher config file
  35. #COPY docker/runners/n8n-task-runners.json /etc/n8n-task-runners.json
  36. COPY ./n8n-task-runners.json /etc/n8n-task-runners.json
  37. USER runner