2022-09-20 08:48:15 +00:00
|
|
|
# docker-python-runner
|
|
|
|
|
2022-09-20 09:12:34 +00:00
|
|
|
[![Build Status](https://drone.asperti.com/api/badges/paspo/docker-python-runner/status.svg)](https://drone.asperti.com/paspo/docker-python-runner)
|
|
|
|
|
|
|
|
Base docker container for running python scripts.
|
2022-09-20 10:53:35 +00:00
|
|
|
|
|
|
|
## usage
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
version: '3.6'
|
|
|
|
services:
|
|
|
|
runner:
|
|
|
|
image: docker.asperti.com/paspo/python-runner:latest
|
|
|
|
container_name: python-scripts
|
|
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
|
|
- ./scripts:/scripts
|
|
|
|
- ./logs:/var/log
|
2022-10-19 23:09:59 +00:00
|
|
|
- ./crontabs:/etc/cron.d:ro
|
2022-09-20 10:53:35 +00:00
|
|
|
environment:
|
2022-09-21 06:38:29 +00:00
|
|
|
TZ: Europe/Rome
|
2022-09-20 10:53:35 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
2022-10-19 23:09:59 +00:00
|
|
|
mkdir scripts logs crontabs
|
2022-09-20 10:53:35 +00:00
|
|
|
touch scripts/test.py && chmod +x scripts/test.py
|
|
|
|
touch scripts/test2.py && chmod +x scripts/test2.py
|
2022-10-19 23:09:59 +00:00
|
|
|
cat <<EOF >crontabs/myscripts
|
|
|
|
*/5 7-22 * * * /scripts/test.py
|
|
|
|
*/10 7-22 * * * /scripts/test2.py
|
|
|
|
EOF
|
2022-09-20 10:53:35 +00:00
|
|
|
docker-compose up -d
|
|
|
|
```
|