Files
thefeed/docker-compose.yml
Mustafa 15137c9e69 feat: add Docker support for server deployment
Add Docker deployment option for the server with multi-stage build.

Changes:
- Dockerfile: multi-stage build (golang:1.26-alpine → alpine:3.21, ~23MB)
- docker-compose.yml: server service on port 5300/udp with iptables redirect
- .env.example: documented environment variables template
- .dockerignore: optimized build context
- README.md & README-FA.md: Docker deployment guide, port 53 safety checks,
  and troubleshooting instructions (both EN and FA)
- configs: added more Telegram channels and X accounts

The container listens on port 5300 to avoid conflict with systemd-resolved.
External DNS traffic (port 53) is redirected via iptables PREROUTING.
No changes to existing Go source code.
2026-04-13 01:04:09 +03:30

61 lines
2.0 KiB
YAML

# ============================================================
# thefeed-server — Docker Compose
# ============================================================
#
# Quick start (public channels, no Telegram login):
# 1. cp .env.example .env (edit with your domain & key)
# 2. mkdir -p data && cp configs/channels.txt data/
# 3. docker compose up -d
# 4. Set up iptables to redirect external port 53 to 5300:
# sudo iptables -t nat -I PREROUTING -i eth0 -p udp --dport 53 -j REDIRECT --to-ports 5300
# sudo iptables -I INPUT -p udp --dport 5300 -j ACCEPT
# (replace eth0 with your network interface — check with: ip a)
#
# With Telegram (one-time login first):
# 1. cp .env.example .env (uncomment Telegram vars)
# 2. docker compose run -it --rm server \
# --login-only --data-dir /data \
# --domain ${THEFEED_DOMAIN} --key ${THEFEED_KEY} \
# --api-id ${TELEGRAM_API_ID} --api-hash ${TELEGRAM_API_HASH} \
# --phone ${TELEGRAM_PHONE}
# 3. Remove --no-telegram from the command below
# 4. docker compose up -d
#
# Logs: docker compose logs -f
# Stop: docker compose down
# ============================================================
services:
server:
build:
context: .
args:
VERSION: ${VERSION:-docker}
COMMIT: ${COMMIT:-unknown}
DATE: ${DATE:-unknown}
container_name: thefeed-server
restart: unless-stopped
ports:
- "5300:5300/udp"
volumes:
- ./data:/data
env_file:
- .env
command: >-
--data-dir /data
--listen :5300
--domain ${THEFEED_DOMAIN}
--key ${THEFEED_KEY}
--no-telegram
# To enable Telegram mode:
# 1. Run login-only first (see instructions above)
# 2. Replace the command above with:
# command: >-
# --data-dir /data
# --listen :5300
# --domain ${THEFEED_DOMAIN}
# --key ${THEFEED_KEY}
# --api-id ${TELEGRAM_API_ID}
# --api-hash ${TELEGRAM_API_HASH}
# --phone ${TELEGRAM_PHONE}