build: publish reproducible patched image
This commit is contained in:
parent
d4aea97dba
commit
6dc5a9428b
4 changed files with 65 additions and 37 deletions
15
Dockerfile
15
Dockerfile
|
|
@ -10,22 +10,17 @@ WORKDIR /usr/src/app
|
||||||
|
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
|
|
||||||
ARG USE_EDGE=false
|
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
COPY vendor/ ./vendor/
|
COPY vendor/ ./vendor/
|
||||||
|
|
||||||
RUN if [ "$USE_EDGE" = "true" ]; then \
|
RUN npm ci --omit=dev --ignore-scripts
|
||||||
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
|
|
||||||
|
|
||||||
# Create the final stage
|
# Create the final stage
|
||||||
FROM base
|
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
|
# Install system dependencies
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
|
|
||||||
67
README.md
67
README.md
|
|
@ -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.
|
**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
|
## 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)
|
[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)
|
[9. Star History](#star-history)
|
||||||
|
|
||||||
## Quick Start with Docker
|
|
||||||
|
|
||||||
[](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`
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
|
||||||
18
docker-compose.build.yml
Normal file
18
docker-compose.build.yml
Normal 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:
|
||||||
|
|
@ -5,7 +5,7 @@ name: wwebjs-api
|
||||||
|
|
||||||
services:
|
services:
|
||||||
api:
|
api:
|
||||||
image: avoylenko/wwebjs-api:latest
|
image: git.eddydevink.nl/eddy/wwebjs-api:1.34.7-serialized-id-2dd7653
|
||||||
container_name: wwebjs-api
|
container_name: wwebjs-api
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue