Files
thc-webhook/README.md
zwitschi fb84af03d4 adding docker compose file
extending instructions to run docker in README
2025-09-14 15:01:44 +02:00

101 lines
2.1 KiB
Markdown

# Discord Webhook 420 Notification App
This Python application sends notifications to a Discord channel via webhook every hour at HH:15 (5 minute reminder) and at HH:20.
## Setup
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Set up your Discord webhook:
- Go to your Discord server settings > Integrations > Webhooks
- Create a new webhook and copy the URL
3. Update the `.env` file with your webhook URL:
```text
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your_webhook_id/your_webhook_token
```
## Running the App
Run the application:
```bash
python main.py
```
The app will run continuously and send notifications at the scheduled times.
## Requirements
- Python 3.6+
- Discord webhook URL
## Docker
Build the Docker image from the provided `Dockerfile`:
```bash
docker build -t thc-webhook .
```
Run the container (pass your webhook URL via environment variable):
```bash
docker run -d \
--name thc-webhook-app \
-e DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/your_webhook_id/your_webhook_token" \
thc-webhook
```
View logs:
```bash
docker logs -f thc-webhook-app
```
Stop and remove the container:
```bash
docker stop thc-webhook-app && docker rm thc-webhook-app
```
### Run with Docker Compose (recommended)
A `docker-compose.yml` is included for easy deployment. It reads `DISCORD_WEBHOOK_URL` from the environment. Create a `.env` next to the `docker-compose.yml` with your webhook URL or export the variable in your shell.
Example `.env`:
```text
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your_webhook_id/your_webhook_token
```
Start the service:
```bash
docker compose up -d
```
Check service logs:
```bash
docker compose logs -f
```
Stop the service:
```bash
docker compose down
```
### Notes
- For production, prefer passing the webhook URL via a secret manager or Docker secrets rather than committing it to `.env`.
- The container runs the app as a non-root user for improved security.
- Use your system's Docker service (Docker Desktop, Docker Engine) to manage images and containers.