Replace with the Host-Cronjob

This commit is contained in:
Simon Rieger 2023-11-23 17:51:17 +01:00
parent 222fc32816
commit f841326c1f
2 changed files with 12 additions and 8 deletions

View file

@ -33,7 +33,7 @@ Before you begin, ensure you have the following installed:
3. **Build and run the Docker container:** 3. **Build and run the Docker container:**
```bash ```bash
docker-compose up --build docker compose up --build
``` ```
This command uses Docker Compose to build and run the container, loading environment variables from the `.env` file. This command uses Docker Compose to build and run the container, loading environment variables from the `.env` file.
@ -47,6 +47,16 @@ Before you begin, ensure you have the following installed:
- If your application uses additional environment variables, add them to the `.env` file. - If your application uses additional environment variables, add them to the `.env` file.
- Customize the Dockerfile or docker-compose.yml if needed. - Customize the Dockerfile or docker-compose.yml if needed.
## Running as a Cronjob
To run your application as a daily cronjob at 6 AM, add the following cronjob entry:
```cron
0 6 * * * docker compose -f /opt/containers/mail-reminder/docker-compose.yml up --build --exit-code-from go-app
```
This cronjob will execute the Docker Compose command daily at 6 AM.
## Contributing ## Contributing
If you'd like to contribute, please fork the repository and create a pull request. Feel free to open an issue if you encounter any problems or have suggestions. If you'd like to contribute, please fork the repository and create a pull request. Feel free to open an issue if you encounter any problems or have suggestions.

View file

@ -6,10 +6,4 @@ services:
context: . context: .
env_file: .env env_file: .env
volumes: volumes:
- /opt/containers/mailu/dav/collection-root:/dav:ro - /opt/containers/mailu/dav/collection-root:/dav:ro
cron:
image: alpine:latest
volumes:
- ./cron-job.sh:/etc/periodic/daily/cron-job
command: ["crond", "-f", "-d", "8"]