init: cron job

This commit is contained in:
b1ek 2024-10-05 13:18:21 +10:00
parent ff50b04d09
commit 1a3a306db5
Signed by: blek
GPG Key ID: A622C22C9BC616B2
5 changed files with 31 additions and 2 deletions

3
.gitignore vendored
View File

@ -10,3 +10,6 @@
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
/.idea/ /.idea/
/supervisord.log
/supervisord.pid

View File

@ -33,7 +33,8 @@ services:
container_name: php-fpm container_name: php-fpm
volumes: volumes:
- ./:/app - ./:/app
- ./docker/php-fpm/php.ini:/usr/local/etc/php/php.ini - ./docker/php-fpm/php.ini:/usr/local/etc/php/php.ini:ro
- ./docker/php-fpm/supervisord.conf:/etc/supervisord.conf:ro
links: links:
- mysql - mysql

View File

@ -1,4 +1,11 @@
FROM php:8.3-fpm FROM php:8.3-fpm-alpine3.20
WORKDIR /app WORKDIR /app
RUN apk add supervisor
RUN docker-php-ext-install pdo pdo_mysql RUN docker-php-ext-install pdo pdo_mysql
COPY crontab.txt /etc/cron.d/update-users
RUN cat /etc/cron.d/update-users >> /etc/crontabs/root
CMD [ "/usr/bin/supervisord", "-c", "/etc/supervisord.conf" ]

View File

@ -0,0 +1 @@
*/15 * * * * /app/bin/console app:update-all-users-cron

View File

@ -0,0 +1,17 @@
[supervisord]
nodaemon=true
[program:cron]
command=/usr/bin/env sh -c "crond -f"
stdout_logfile=/var/log/cron
stderr_logfile=/var/log/cron.stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
autorestart=true
[program:php-fpm]
command=docker-php-entrypoint php-fpm
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0