apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: ams-task
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
imagePullSecrets:
- name: aliyuncs-registry
containers:
- name: ams-task
image: laravel:latest
command: ["/usr/local/bin/php","/var/www/html/artisan","schedule:run"]
imagePullPolicy: Always
restartPolicy: OnFailure
successfulJobsHistoryLimit: 1
docker-compose定时任务处理
* * * * * cd /www/wwwroot/ams-task&&/usr/bin/docker-compose exec -T ams-task php /var/www/html/artisan schedule:run