Add Docker Compose setup and clean up legacy code
- Add docker-compose.yml with volume mounts for config/sfx - Simplify npm scripts (up/down/build/restart/logs) - Update README.md and CLAUDE.md with new commands - Remove unused lib/ directory (migrated to src/) - Update package.json scripts to cleaner naming Benefits: - Update configs and sound effects without rebuilding image - Simplified Docker workflow management - Cleaner project structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
62
docker-compose.yml
Normal file
62
docker-compose.yml
Normal file
@@ -0,0 +1,62 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
discord-bot:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: discord-bot
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
# Configuration files (read-only)
|
||||
- ./config.json:/app/config.json:ro
|
||||
- ./conf:/app/conf:ro
|
||||
|
||||
# Sound effects directory (read-only)
|
||||
- ./sfx:/app/sfx:ro
|
||||
|
||||
# Optional: Mount logs directory if you want persistent logs
|
||||
# - ./logs:/app/logs
|
||||
|
||||
# Optional: Environment variables
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
# - DEBUG=true # Uncomment for debug mode
|
||||
|
||||
# Optional: Resource limits
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 512M
|
||||
reservations:
|
||||
memory: 256M
|
||||
|
||||
# Optional: Health check
|
||||
healthcheck:
|
||||
test: ["CMD", "node", "-e", "process.exit(0)"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Optional: Add a volume backup service
|
||||
# backup:
|
||||
# image: alpine:latest
|
||||
# container_name: ghbot-backup
|
||||
# volumes:
|
||||
# - ./config.json:/backup/config.json:ro
|
||||
# - ./conf:/backup/conf:ro
|
||||
# - ./sfx:/backup/sfx:ro
|
||||
# command: |
|
||||
# sh -c "
|
||||
# echo 'Creating backup...'
|
||||
# tar czf /backup/ghbot-backup-$(date +%Y%m%d_%H%M%S).tar.gz -C /backup config.json conf sfx
|
||||
# echo 'Backup complete'
|
||||
# "
|
||||
# profiles:
|
||||
# - backup
|
||||
|
||||
# Optional: Create named volumes for persistent data
|
||||
# volumes:
|
||||
# ghbot_logs:
|
||||
# driver: local
|
||||
Reference in New Issue
Block a user