open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.11k stars 591 forks source link

Dockerfile discussion #533

Closed smashah closed 4 years ago

smashah commented 4 years ago

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

roelandp commented 4 years ago

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

smashah commented 4 years ago

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

smashah commented 4 years ago

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.

roelandp commented 4 years ago

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?

sandro-salles commented 4 years ago

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"]
smashah commented 4 years ago

@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

buster95 commented 4 years ago

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