I'm trying to Dockerize my Express API which uses Puppeteer. The server starts listening but when it goes to initialize the bot I get an error.
After running: docker-compose up
I get:
...
bot-api | Server listening on port: 3000
bot-api | /app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:248
bot-api | reject(new Error([
bot-api | ^
bot-api |
bot-api | Error: Failed to launch the browser process!
bot-api | /app/node_modules/puppeteer/.local-chromium/linux-991974/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
...
Here's my Dockerfile and docker-compose.yml
Dockerfile
FROM node as builder
WORKDIR /app
COPY . .
RUN npm install
CMD ["npm", "start"]
docker-compose.yml
version: '3.7'
services:
db:
image: postgres
restart: always
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: bot-db
volumes:
- ./docker_postgres_init.sql:/docker-entrypoint-initdb.d/docker_postgres_init.sql
ports:
- '5432:5432'
web:
container_name: bot-api
build: .
depends_on:
- db
ports:
- '3000:3000'