added docker
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Docker ignore file for Excommunicado
|
||||
|
||||
# Environment & secrets
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Data directory (we mount it as volume instead)
|
||||
data/
|
||||
|
||||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.egg-info/
|
||||
.venv/
|
||||
venv/
|
||||
|
||||
# IDE / OS
|
||||
.vscode/
|
||||
.idea/
|
||||
*.log
|
||||
Thumbs.db
|
||||
.DS_Store
|
||||
|
||||
# Docker
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
docker-compose*.yml
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
# Dockerfile for Excommunicado Discord Bot
|
||||
FROM python:3.12-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies (if needed)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first (better layer caching)
|
||||
COPY requirements.txt .
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the rest of the application
|
||||
COPY . .
|
||||
|
||||
# Create data directory for persistence
|
||||
RUN mkdir -p /app/data
|
||||
|
||||
# Create non-root user for security
|
||||
RUN useradd -m botuser && chown -R botuser:botuser /app
|
||||
USER botuser
|
||||
|
||||
# Run the bot
|
||||
CMD ["python", "bot.py"]
|
||||
@@ -56,6 +56,32 @@ Ideal for:
|
||||
|
||||
## Installation & Quick Start
|
||||
|
||||
### Docker Deployment (Recommended)
|
||||
|
||||
1. Make sure you have Docker and Docker Compose installed.
|
||||
2. Copy `.env.example` → `.env` and fill in your token.
|
||||
3. Build and run the container:
|
||||
|
||||
```powershell
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
The bot runs as a non-root user with healthchecks and log rotation.
|
||||
|
||||
To view logs:
|
||||
```powershell
|
||||
docker compose logs -f excommunicado-bot
|
||||
```
|
||||
|
||||
To stop:
|
||||
```powershell
|
||||
docker compose down
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Manual Installation (Non-Docker)
|
||||
|
||||
### 1. Prepare the project
|
||||
```
|
||||
cd ~/Excommunicado # or your chosen folder
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
excommunicado:
|
||||
build: .
|
||||
container_name: excommunicado-bot
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
Reference in New Issue
Block a user