FIX: cron ENV vars

This commit is contained in:
Juan Pablo Vial
2024-02-10 10:37:45 -03:00
parent 3cd699d2e2
commit 251dbbe0f0
4 changed files with 29 additions and 36 deletions

View File

@ -1,16 +1,20 @@
FROM php:8.2-fpm FROM php:8.2-cli
ENV TZ "America/Santiago" ENV TZ "${TZ}"
ENV APP_NAME "${APP_NAME}"
ENV API_URL "${API_URL}"
RUN apt-get update && apt-get install -y --no-install-recommends cron && rm -r /var/lib/apt/lists/* RUN apt-get update && apt-get install -y --no-install-recommends cron rsyslog nano && rm -r /var/lib/apt/lists/*
RUN pecl install xdebug-3.2.2 \ RUN pecl install xdebug-3.2.2 \
&& docker-php-ext-enable xdebug && docker-php-ext-enable xdebug \
&& echo "#/bin/bash\nprintenv >> /etc/environment\ncron -f -L 11" > /root/entrypoint && chmod a+x /root/entrypoint
COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini COPY ./php-errors.ini /usr/local/etc/php/conf.d/docker-php-errors.ini
WORKDIR /code/bin WORKDIR /code/bin
COPY ./cli/crontab /var/spool/cron/crontabs/root #COPY --chmod=644 ./cli/crontab /etc/cron.d/cronjob
COPY --chmod=644 ./cli/crontab /var/spool/cron/crontabs/root
CMD ["cron", "-f"] CMD [ "/root/entrypoint" ]

5
cli/bin/incoviba Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
. /etc/profile
/usr/local/bin/php /code/bin/index.php "$@"

View File

@ -1,8 +1,8 @@
0 2 * * * php /code/bin/index.php ventas:cuotas:hoy 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cuotas:hoy >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php ventas:cuotas:pendientes 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cuotas:pendientes >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php ventas:cuotas:vencer 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cuotas:vencer >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php ventas:cierres:vigentes 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba ventas:cierres:vigentes >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php proyectos:activos 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba proyectos:activos >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php comunas 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba comunas >> /logs/commands 2>&1
0 2 * * * php /code/bin/index.php money:uf 2>&1 >> /logs/commands 0 2 * * * /code/bin/incoviba money:uf >> /logs/commands 2>&1
0 2 1 * * php /code/bin/index.php money:ipc 2>&1 >> /logs/commands 0 2 1 * * /code/bin/incoviba money:ipc >> /logs/commands 2>&1

View File

@ -1,15 +1,10 @@
version: '3'
x-restart: &restart
restart: unless-stopped
services: services:
proxy: proxy:
profiles: profiles:
- app - app
image: nginx:alpine image: nginx:alpine
container_name: incoviba_proxy container_name: incoviba_proxy
<<: *restart restart: unless-stopped
ports: ports:
- "${APP_PORT}:80" - "${APP_PORT}:80"
volumes: volumes:
@ -22,12 +17,10 @@ services:
- app - app
build: . build: .
container_name: incoviba_web container_name: incoviba_web
<<: *restart restart: unless-stopped
env_file: env_file:
- ${APP_PATH:-.}/.env - ${APP_PATH:-.}/.env
# - ${APP_PATH:-.}/.db.env
- ./.key.env - ./.key.env
#- ${APP_PATH:-.}/.remote.env
volumes: volumes:
- ${APP_PATH:-.}/:/code - ${APP_PATH:-.}/:/code
- ./logs/php:/logs - ./logs/php:/logs
@ -37,7 +30,7 @@ services:
- db - db
image: mariadb:latest image: mariadb:latest
container_name: incoviba_db container_name: incoviba_db
<<: *restart restart: unless-stopped
env_file: ${APP_PATH:-.}/.db.env env_file: ${APP_PATH:-.}/.db.env
volumes: volumes:
- dbdata:/var/lib/mysql - dbdata:/var/lib/mysql
@ -53,22 +46,13 @@ services:
- cache - cache
image: redis image: redis
container_name: incoviba_redis container_name: incoviba_redis
<<: *restart restart: unless-stopped
env_file: ${APP_PATH:-.}/.redis.env env_file: ${APP_PATH:-.}/.redis.env
volumes: volumes:
- incoviba_redis:/data - incoviba_redis:/data
ports: ports:
- "63790:6379" - "63790:6379"
python:
profiles:
- python
build:
context: .
dockerfile: Python.Dockerfile
container_name: incoviba_python
<<: *restart
logview: logview:
profiles: profiles:
- log - log
@ -81,7 +65,7 @@ services:
WEB_URL: 'http://provm.cl:8084' WEB_URL: 'http://provm.cl:8084'
WEB_PORT: '8084' WEB_PORT: '8084'
volumes: volumes:
- "./logs:/logs" - ./logs:/logs
ports: ports:
- "8084:80" - "8084:80"
cli: cli:
@ -91,7 +75,7 @@ services:
context: . context: .
dockerfile: CLI.Dockerfile dockerfile: CLI.Dockerfile
container_name: incoviba_cli container_name: incoviba_cli
<<: *restart restart: unless-stopped
env_file: env_file:
- ${CLI_PATH:-.}/.env - ${CLI_PATH:-.}/.env
- ./.key.env - ./.key.env