A calibre container with cron support to download daily news
|
|
4 päivää sitten | |
|---|---|---|
| build | 11 kuukautta sitten | |
| crond | 11 kuukautta sitten | |
| recipe | 4 päivää sitten | |
| .env | 11 kuukautta sitten | |
| docker-compose.yml | 11 kuukautta sitten | |
| readme.md | 11 kuukautta sitten | |
| run_now.sh | 11 kuukautta sitten |
This repository contains a Dockerfile, Docker Compose configuration, and associated scripts to set up a Calibre environment within a Docker container. The container is based on the official Ubuntu image and includes Calibre, cron for scheduling tasks, and an entrypoint script to handle timezone configuration and cron service startup. The Docker Compose file simplifies the deployment process by allowing you to configure environment variables, volumes, and ports in a single file.
TZ environment variable.docker-compose.yml.The docker-compose.yml file simplifies the deployment process. Below is the configuration:
services:
calibre-cron:
image: calibre-cron:0.9
container_name: ${CALIBRE_NAME}
environment:
- PUID=1000
- PGID=1000
- TZ=Asia/Hong_Kong
volumes:
- ${CALIBRE_CRON}:/etc/cron.d
- ${CALIBRE_RECIPE}:/calibre/recipe
- ${NEWS_PATH}:/news
ports:
- 8780:8080
- 8781:8081
restart: "no"
CALIBRE_NAME: The name of the container.PUID: User ID for file permissions (default: 1000).PGID: Group ID for file permissions (default: 1000).TZ: Timezone (default: Asia/Hong_Kong).CALIBRE_CRON: Path to the host directory for custom cron jobs.CALIBRE_RECIPE: Path to the host directory for Calibre recipes.NEWS_PATH: Path to the host directory for news files.8780:8080: Maps host port 8780 to container port 8080.8781:8081: Maps host port 8781 to container port 8081.${CALIBRE_CRON}:/etc/cron.d: Mounts the host directory for custom cron jobs.${CALIBRE_RECIPE}:/calibre/recipe: Mounts the host directory for Calibre recipes.${NEWS_PATH}:/news: Mounts the host directory for news files.To build the Docker image, navigate to the directory containing the Dockerfile and run:
docker build -t calibre-cron:0.9 .
Create a .env file in the same directory as docker-compose.yml and define the required environment variables:
CALIBRE_NAME=my-calibre-container
CALIBRE_CRON=/path/to/cron/jobs
CALIBRE_RECIPE=/path/to/calibre/recipes
NEWS_PATH=/path/to/news/files
Start the container using Docker Compose:
docker-compose up -d
You can add custom cron jobs by placing them in the ${CALIBRE_CRON} directory on your host machine. The provided calibre-cron file is an example of a cron job that runs a script at 5 AM daily:
0 5 * * * /calibre/recipe/upkindle.sh >> /var/log/upkindle.log 2>&1
The entrypoint.sh script handles timezone configuration and starts the cron service. It checks for the TZ environment variable and sets the timezone accordingly.
/calibre/library: Directory for storing Calibre library files./etc/cron.d: Directory for custom cron jobs./var/log/calibre-cron.log: Log file for cron job output (optional)./calibre/recipe: Directory for Calibre recipes./news: Directory for news files.The calibre-cron file contains an example cron job that runs a script at 5 AM daily:
0 5 * * * /calibre/recipe/upkindle.sh >> /var/log/upkindle.log 2>&1
Cron job output can be logged to /var/log/calibre-cron.log for debugging purposes. Ensure your cron jobs redirect their output to this file or another log file as needed.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
For support, please open an issue in the repository or contact the maintainer directly.
This README provides a comprehensive guide to setting up and running the Calibre Docker container with Docker Compose. For more detailed instructions, refer to the Dockerfile, docker-compose.yml, and associated scripts.