Files

27 lines
1.4 KiB
YAML

services:
borgmatic:
image: ghcr.io/borgmatic-collective/borgmatic:latest
container_name: borgmatic
restart: unless-stopped
volumes:
- /opt/docker:/mnt/source:ro # 🔍 Maps your entire stack (read-only) as the backup source
- ${DOCKER_DATA_DIR}/borgmatic:/etc/borgmatic # ⚙️ Config folder (holds config.yaml + .env)
- ${DOCKER_DATA_DIR}/borgmatic/.ssh:/root/.ssh # 🔐 SSH key pair for BorgBase access
- ${DOCKER_DATA_DIR}/borgmatic/repo:/mnt/borg-repository # 💾 Optional local repo folder (not used)
- ${DOCKER_DATA_DIR}/borgmatic/borg:/root/.config/borg # 🧠 Borg key and config files
- ${DOCKER_DATA_DIR}/borgmatic/cache:/root/.cache/borg # ⚡ Cache for deduplication and performance
environment:
- TZ=${TZ} # 🌍 Timezone from main .env
- PUID=${PUID} # 👤 Your user ID (for file permissions)
- PGID=${PGID} # 👥 Your group ID
- BORG_PASSPHRASE=${BORG_PASSPHRASE} # 🔐 Secure passphrase (don't hardcode in config.yaml)
- BORG_REPO_URL=${BORG_REPO_URL} # 📦 BorgBase SSH repository path
- BACKUP_CRON=0 4 * * 0 # 🕓 Weekly backup: Every Sunday at 4 AM
- RUN_ON_STARTUP=true # 🚀 Trigger a backup when the container starts
profiles:
- borgmatic # 🧩 Use this profile to selectively start this service
- all # ✅ Include in full stack if needed