adding docker compose file

extending instructions to run docker in README
This commit is contained in:
2025-09-14 15:01:44 +02:00
parent 262d5fca91
commit fb84af03d4
2 changed files with 77 additions and 0 deletions

View File

@@ -35,3 +35,66 @@ The app will run continuously and send notifications at the scheduled times.
- Python 3.6+ - Python 3.6+
- Discord webhook URL - 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.

14
docker-compose.yml Normal file
View File

@@ -0,0 +1,14 @@
version: "3.8"
services:
thc-webhook:
build: .
container_name: thc-webhook-app
environment:
- DISCORD_WEBHOOK_URL=${DISCORD_WEBHOOK_URL}
restart: unless-stopped
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"