Wa-automate-nodejs: Dockerfile discussion

Created on 10 Jun 2020  路  7Comments  路  Source: open-wa/wa-automate-nodejs

Need an example with and without support for sending video/gifs

PRIORITY

Most helpful comment

This is mine... not using ffmpg but in theory it麓s easy do install on RUN:

FROM node:12.18.0-buster-slim

WORKDIR /usr/src/app
COPY . .
RUN rm -rf /usr/src/app/node_modules/
RUN npm install


ENV CHROME_VERSION=81.0.4044.138-1

RUN set -x \
  && apt-get update \
  && apt-get install wget --yes \
  && wget --no-check-certificate https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt -y -f install \
  && rm google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && apt autoremove --yes

ENV CHROME_BIN /usr/bin/google-chrome-stable

CMD ["npm", "start"]

All 7 comments

What would be the difference in both? ffmpeg yes/no right? (for gifs).

@roelandp in order to send videos and gifs, FFmpeg support is required and useChrome: true

I am making one now, however I would greatly appreciate if anybody can share their own so we can find the optimum Dockerfile to use.

Here is mine I created, with Google chrome but without ffmpeg (don't use that feature):
https://gist.github.com/roelandp/a485c47390f616b1a1c836315f951f40

If you find a way to always use the latest release of openwa and not cache the NPM install part let me know (haven't researched that part, now I just update package json to newest version number to prevent Docker build caching for that part).

Btw. would you need ffmpeg for just "sendVideo" (without gif) and is there a "sendVideo"? or should I use "sendFile" then?

This is mine... not using ffmpg but in theory it麓s easy do install on RUN:

FROM node:12.18.0-buster-slim

WORKDIR /usr/src/app
COPY . .
RUN rm -rf /usr/src/app/node_modules/
RUN npm install


ENV CHROME_VERSION=81.0.4044.138-1

RUN set -x \
  && apt-get update \
  && apt-get install wget --yes \
  && wget --no-check-certificate https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt -y -f install \
  && rm google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && apt autoremove --yes

ENV CHROME_BIN /usr/bin/google-chrome-stable

CMD ["npm", "start"]

@sandro-salles @roelandp

Please check out:

https://github.com/open-wa/wa-automate-docker

It's really efficient, offloads the browser onto browserless (which the processes hooks into using browserWSEndpoint and very simple.

Please check it out and let me know if there are any issues.

Thanks

This is mine... not using ffmpg but in theory it麓s easy do install on RUN:

FROM node:12.18.0-buster-slim

WORKDIR /usr/src/app
COPY . .
RUN rm -rf /usr/src/app/node_modules/
RUN npm install


ENV CHROME_VERSION=81.0.4044.138-1

RUN set -x \
  && apt-get update \
  && apt-get install wget --yes \
  && wget --no-check-certificate https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb || apt -y -f install \
  && rm google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && apt autoremove --yes

ENV CHROME_BIN /usr/bin/google-chrome-stable

CMD ["npm", "start"]

Thank u dude, helpful

Was this page helpful?
0 / 5 - 0 ratings