Initial Discord bot in Docker behind a per-container Cloudflare WARP tunnel

- discord.js 14 bot with /ping and /warp, periodic WARP egress-IP logging
- Dockerfile: node:22-bookworm-slim + cloudflare-warp 2026.7.1377.0 (.deb)
- entrypoint boots dbus/warp-svc, registers, connects, verifies warp=on
- docker-compose with NET_ADMIN, /dev/net/tun, sysctls, healthcheck
- deploy script, README, CHANGELOG, lockfile generated inside Docker

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 01:16:32 +02:00
parent bcf7b67ef7
commit 1a9dc1d676
14 changed files with 904 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
# Every service defined here is a fully self-contained bot: it runs its own
# Cloudflare WARP client inside the container, so each bot gets its own VPN
# tunnel and its own Cloudflare egress IP. To run a second bot, copy the
# `bot` service block, give it a different name, env file and volume.
x-warp-bot: &warp-bot
build:
context: .
dockerfile: docker/Dockerfile
args:
WARP_VERSION: "2026.7.1377.0"
image: discordbot-cloudflarewarp:latest
restart: unless-stopped
# WARP needs to create a TUN device and manage routes inside the container.
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
sysctls:
net.ipv6.conf.all.disable_ipv6: 0
net.ipv4.conf.all.src_valid_mark: 1
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
services:
bot:
<<: *warp-bot
container_name: discordbot-warp
env_file: .env
volumes:
- warp-data-bot:/var/lib/cloudflare-warp
# Example second bot with its own WARP tunnel and its own token:
# bot2:
# <<: *warp-bot
# container_name: discordbot-warp-2
# env_file: .env.bot2
# volumes:
# - warp-data-bot2:/var/lib/cloudflare-warp
volumes:
warp-data-bot:
# warp-data-bot2: