docker add cleanup service

This commit is contained in:
xiaomlove
2025-05-13 18:21:14 +07:00
parent 55a30939dd
commit 3e45bc43ad
2 changed files with 31 additions and 0 deletions

View File

@@ -91,6 +91,18 @@ elif [ "$SERVICE_NAME" = "scheduler" ]; then
sleep 5;
fi
done
elif [ "$SERVICE_NAME" = "cleanup" ]; then
echo_info "Start Cleanup ...";
while true; do
if [ -f "$ENV_FILE" ] && [ -d "$VENDOR_DIR" ]; then
echo_success "[Cleanup] Run cleanup:run at $(date '+%Y-%m-%d %H:%M:%S')";
php include/cleanup_cli.php;
sleep 60;
else
echo_info "[Cleanup] .env or vendor not existswait 5 seconds...";
sleep 5;
fi
done
else
echo_error "Unknown SERVICE_NAME: $SERVICE_NAME, exiting."
exit 1

View File

@@ -56,6 +56,25 @@ services:
max-file: "3"
networks:
- appnet
-
cleanup:
image: nexusphp_php
container_name: nexusphp-cleanup
environment:
SERVICE_NAME: cleanup
volumes:
- .:/var/www/html
depends_on:
- php
- redis
- mysql
logging:
driver: "json-file"
options:
max-size: "1024m"
max-file: "3"
networks:
- appnet
openresty:
build: