diff --git a/README.md b/README.md index 84a863c..c85de87 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,66 @@ The app will run continuously and send notifications at the scheduled times. - 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. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ee45c6c --- /dev/null +++ b/docker-compose.yml @@ -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"