waha icon indicating copy to clipboard operation
waha copied to clipboard

Reduce the docker image

Open sunilsankar opened this issue 2 years ago • 4 comments

Hi is it possible to reduce the docker image size. I see that it is 1.92GB for arm .Can we use alpine image instead of bullseye and also reducing the number of layers make the image small. Better to have different images for noweb and webjs. Just a suggestion . Awesome project btw :)

REPOSITORY                      TAG       IMAGE ID       CREATED       SIZE
devlikeapro/whatsapp-http-api   arm       40ff15031379   11 days ago   1.92GB

sunilsankar avatar Jul 28 '23 09:07 sunilsankar

+1 @sunilsankar @allburov Using scratch or alpine + using docker-slim to further squeeze the image size.

ksingh7 avatar Aug 02 '23 07:08 ksingh7

Hi! Great idea, I'm facing the problem with the image size while using 3G mobile internet :D

I'd love to keep the original and latest image as debian based and "all inclusive" tho. For the start we could create these images (it'll reduce about 500MB memory that chromium uses)

  • devlikepro/whatsapp-http-api:latest - Debian, all installed
  • devlikepro/whatsapp-http-api:slim - Debian, no chromium
  • devlikepro/whatsapp-http-api:arm - Debian ARM, all installed
  • devlikepro/whatsapp-http-api:arm-slim - debian ARM, all installed

In the next step we could try to use alpine (I'm skeptical about docker-slim...) and create a bit more images

  • devlikepro/whatsapp-http-api:alpine - Debian, all installed
  • devlikepro/whatsapp-http-api:alpine-slim - alpine, no chromium
  • devlikepro/whatsapp-http-api:arm-alpine - alpine ARM, all installed
  • devlikepro/whatsapp-http-api:arm-alpine-slim - debian ARM, all installed

8 images... If there's anyone who could contribute to the project so we can have 2 Dockerfiles for that Dockerfile and Dockerfile.alpine - it'd be great :pray:

I'd start with the first step - separating chrome\no-chrome builds For "with chromium" and "no chromium" we could use multi stage builds so we don't have to maintain 4 Dockerfiles and keep them in sync...

allburov avatar Aug 06 '23 15:08 allburov

I will try to contribute @allburov

sunilsankar avatar Aug 08 '23 15:08 sunilsankar

Hi! I've added 3 different images - default with chromium, with chrome and no browser (for NOWEB engine) https://waha.devlike.pro/docs/how-to/engines/#docker-images

devlikeapro/whatsapp-http-api                                  noweb              1.49GB
devlikeapro/whatsapp-http-api                                  chrome             2GB
devlikeapro/whatsapp-http-api                                  latest             2.05GB

It shouldn't be hard to extend it with alpine or similar small base image using github matrix https://github.com/devlikeapro/whatsapp-http-api/blob/core/.github/workflows/build.yaml

The tags should be start with alpine in this way

  • alpine-latest
  • alpine-chrome
  • alpine-noweb-arm (no chrome available for arm)

Contributions are welcome!

allburov avatar Nov 05 '23 13:11 allburov