DEV Community

Yaroslav Shelomentsev
Yaroslav Shelomentsev

Posted on

Docker image for puppeteer

Dockerfile:

FROM node:18

RUN apt-get update \
    && apt-get install -y wget gnupg \
    && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
    && apt-get update \
    && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
      --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*
Enter fullscreen mode Exit fullscreen mode

Then, you need to create local docker image:

docker build -t node18-ppt .
Enter fullscreen mode Exit fullscreen mode

And, then, use it, for example in docker-compose.yml:

version: '3.8'
services:
  my_api_with_puppeteer:
    image: node18-ppt
    container_name: my_api_with_puppeteer
    working_dir: /srv/web
    volumes:
      - /srv/web:/srv/web
    command: bash -c "yarn install && yarn start"
    restart: always
Enter fullscreen mode Exit fullscreen mode

Top comments (0)