mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 00:30:50 +08:00
docker add cleanup service
This commit is contained in:
@@ -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 exists,wait 5 seconds...";
|
||||
sleep 5;
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo_error "Unknown SERVICE_NAME: $SERVICE_NAME, exiting."
|
||||
exit 1
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user