Replace the relative ./sessions bind mount with a Docker-managed named volume so WhatsApp sessions survive container recreation and redeploys (e.g. on Dokploy), instead of being reset on every fresh deploy.
55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
# The version property is now optional in modern Docker Compose
|
|
# version: '3.8'
|
|
|
|
name: wwebjs-api
|
|
|
|
services:
|
|
api:
|
|
image: avoylenko/wwebjs-api:latest
|
|
container_name: wwebjs-api
|
|
restart: always
|
|
ports:
|
|
- "${PORT:-3000}:${PORT:-3000}"
|
|
env_file: .env
|
|
volumes:
|
|
# Use a named Docker volume so WhatsApp sessions persist across
|
|
# container recreations / redeploys (e.g. on Dokploy). The data lives
|
|
# in Docker-managed storage, NOT inside the repository directory, so a
|
|
# fresh deploy no longer resets the session.
|
|
- wwebjs_sessions:/usr/src/app/sessions
|
|
# Optional: route Chromium (WhatsApp Web) traffic through an outbound proxy.
|
|
# Set PROXY_URL (and optionally PROXY_USERNAME / PROXY_PASSWORD for HTTP
|
|
# Basic auth) in .env, or uncomment the block below to point at the
|
|
# bundled tinyproxy service.
|
|
# environment:
|
|
# PROXY_URL: http://tinyproxy:8888
|
|
# # PROXY_USERNAME: api-key
|
|
# # PROXY_PASSWORD: your-api-key
|
|
# depends_on:
|
|
# - tinyproxy
|
|
# Optional healthcheck
|
|
# healthcheck:
|
|
# test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
|
# interval: 30s
|
|
# timeout: 10s
|
|
# retries: 3
|
|
# start_period: 40s
|
|
|
|
# Optional: local HTTP proxy for testing the PROXY_URL feature end-to-end.
|
|
# Uncomment along with the api `environment` / `depends_on` blocks above.
|
|
# tinyproxy:
|
|
# image: vimagick/tinyproxy
|
|
# container_name: wwebjs-tinyproxy
|
|
# ports:
|
|
# - "8888:8888"
|
|
# environment:
|
|
# ALLOWED_NETWORKS: 0.0.0.0/0
|
|
# # Uncomment to test the PROXY_USERNAME / PROXY_PASSWORD path.
|
|
# # BASIC_AUTH_USER: "api-key"
|
|
# # BASIC_AUTH_PASSWORD: "your-api-key"
|
|
# restart: unless-stopped
|
|
|
|
# Named volumes managed by Docker. Persists independently of the container
|
|
# and the repository working directory, so sessions survive redeploys.
|
|
volumes:
|
|
wwebjs_sessions:
|