build: publish reproducible patched image

This commit is contained in:
Eddy de Vink 2026-08-18 10:04:02 +02:00
commit 6dc5a9428b
4 changed files with 65 additions and 37 deletions

View file

@ -10,22 +10,17 @@ WORKDIR /usr/src/app
FROM base AS deps
ARG USE_EDGE=false
COPY package*.json ./
COPY vendor/ ./vendor/
RUN if [ "$USE_EDGE" = "true" ]; then \
apt-get update && apt-get install -y --no-install-recommends git ca-certificates && \
npm ci --only=production --ignore-scripts && \
npm install --save-exact git+https://github.com/pedroslopez/whatsapp-web.js.git#main && \
apt-get purge -y git ca-certificates && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*; \
else \
npm ci --only=production --ignore-scripts; \
fi
RUN npm ci --omit=dev --ignore-scripts
# Create the final stage
FROM base
ARG PATCH_COMMIT=2dd76538984ce44d23f59008bb50d997fcef28a2
LABEL org.opencontainers.image.source="https://git.eddydevink.nl/eddy/wwebjs-api" \
org.opencontainers.image.revision="$PATCH_COMMIT" \
org.opencontainers.image.description="wwebjs-api with the WhatsApp Web serialized message ID patch"
# Install system dependencies
RUN apt-get update && \

View file

@ -9,9 +9,49 @@ The project is a work in progress: star it, create issues, features or pull requ
**NOTE**: I can't guarantee you will not be blocked by using this method, although it has worked for me. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
## Patched public distribution
This Forgejo fork bundles a patched `whatsapp-web.js` release that tolerates
WhatsApp Web message IDs exposed as `$1` instead of `_serialized`.
- Source repository: [eddy/wwebjs-api](https://git.eddydevink.nl/eddy/wwebjs-api)
- Patched library: [eddy/whatsapp-web.js](https://git.eddydevink.nl/eddy/whatsapp-web.js)
- Public image: `git.eddydevink.nl/eddy/wwebjs-api:1.34.7-serialized-id-2dd7653`
The image is built from the Dockerfile in this repository and pins the patched
library archive through `package-lock.json`. It is not an official WhatsApp or
whatsapp-web.js release.
## Quick Start with the patched image
```bash
git clone https://git.eddydevink.nl/eddy/wwebjs-api.git
cd wwebjs-api
cp .env.example .env
# Set BASE_WEBHOOK_URL and a strong API_KEY in .env.
docker compose pull
docker compose up -d
```
The default Compose file uses the public patched image. The API listens on
`PORT` (3000 by default). Start a session and scan its QR code with:
```bash
curl http://localhost:3000/session/start/ABCD
```
For a completely local, reproducible build instead of pulling the image:
```bash
docker compose -f docker-compose.build.yml up -d --build
```
The build uses the committed `vendor/whatsapp-web.js-1.34.7.tgz` archive and
does not download an unpatched upstream `main` branch.
## Table of Contents
[1. Quick Start with Docker](#quick-start-with-docker)
[1. Quick Start with the patched image](#quick-start-with-the-patched-image)
[2. Features](#features)
@ -29,31 +69,6 @@ The project is a work in progress: star it, create issues, features or pull requ
[9. Star History](#star-history)
## Quick Start with Docker
[![dockeri.co](https://dockerico.blankenship.io/image/avoylenko/wwebjs-api)](https://hub.docker.com/r/avoylenko/wwebjs-api)
1. Clone the repository:
```bash
git clone https://github.com/avoylenko/wwebjs-api.git
cd wwebjs-api
```
3. Run the Docker Compose:
```bash
docker compose pull && docker compose up
```
4. Visit http://localhost:3000/session/start/ABCD
5. Scan the QR on your console using WhatsApp mobile app -> Linked Device -> Link a Device (it may take time to setup the session)
6. Visit http://localhost:3000/client/getContacts/ABCD
7. EXTRA: Look at all the callbacks data in `./session/message_log.txt`
![Quick Start](./assets/basic_start.gif)
## Features

18
docker-compose.build.yml Normal file
View file

@ -0,0 +1,18 @@
name: wwebjs-api
services:
api:
build:
context: .
dockerfile: Dockerfile
image: wwebjs-api:patched
container_name: wwebjs-api
restart: always
ports:
- "${PORT:-3000}:${PORT:-3000}"
env_file: .env
volumes:
- wwebjs_sessions:/usr/src/app/sessions
volumes:
wwebjs_sessions:

View file

@ -5,7 +5,7 @@ name: wwebjs-api
services:
api:
image: avoylenko/wwebjs-api:latest
image: git.eddydevink.nl/eddy/wwebjs-api:1.34.7-serialized-id-2dd7653
container_name: wwebjs-api
restart: always
ports: