Dockerfile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. FROM node:slim
  2. # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
  3. # Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
  4. # installs, work.
  5. RUN apt-get update \
  6. && apt-get install -y wget gnupg \
  7. && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
  8. && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
  9. && apt-get update \
  10. && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
  11. --no-install-recommends \
  12. && rm -rf /var/lib/apt/lists/*
  13. # If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise
  14. # uncomment the following lines to have `dumb-init` as PID 1
  15. # ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init
  16. # RUN chmod +x /usr/local/bin/dumb-init
  17. # ENTRYPOINT ["dumb-init", "--"]
  18. # Uncomment to skip the chromium download when installing puppeteer. If you do,
  19. # you'll need to launch puppeteer with:
  20. # browser.launch({executablePath: 'google-chrome-stable'})
  21. # ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
  22. WORKDIR /home/pptruser
  23. # Install puppeteer so it's available in the container.
  24. RUN npm install -g npm@latest \
  25. && npm init -y \
  26. && npm i puppeteer \
  27. # Add user so we don't need --no-sandbox.
  28. # same layer as npm install to keep re-chowned files from using up several hundred MBs more space
  29. && groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
  30. && mkdir -p /home/pptruser/Downloads \
  31. && chown -R pptruser:pptruser /home/pptruser \
  32. && chmod -R 777 /tmp \
  33. && apt-get update \
  34. && apt-get install -y socat \
  35. && npm config set update-notifier false
  36. COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
  37. RUN chmod +x /usr/local/bin/entrypoint.sh
  38. # Run everything after as non-privileged user.
  39. USER pptruser
  40. ENTRYPOINT ["bash", "/usr/local/bin/entrypoint.sh"]