mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-29 06:48:45 +00:00
chore: using new method dockerSafeExec()
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
|||||||
initializeTraefikService,
|
initializeTraefikService,
|
||||||
type TraefikOptions,
|
type TraefikOptions,
|
||||||
} from "../setup/traefik-setup";
|
} from "../setup/traefik-setup";
|
||||||
|
import { dockerSafeExec } from "@dokploy/server/utils/docker/utils.ts";
|
||||||
|
|
||||||
export interface IUpdateData {
|
export interface IUpdateData {
|
||||||
latestVersion: string | null;
|
latestVersion: string | null;
|
||||||
@@ -226,58 +227,24 @@ export const cleanupFullDocker = async (serverId?: string | null) => {
|
|||||||
if (serverId) {
|
if (serverId) {
|
||||||
await execAsyncRemote(
|
await execAsyncRemote(
|
||||||
serverId,
|
serverId,
|
||||||
`
|
dockerSafeExec(`
|
||||||
CHECK_INTERVAL=10
|
${cleanupImages}
|
||||||
|
${cleanupVolumes}
|
||||||
echo "Starting Docker cleanup..."
|
${cleanupContainers}
|
||||||
|
${cleanupSystem}
|
||||||
while true; do
|
${cleanupBuilder}
|
||||||
PROCESSES=$(ps aux | grep -E "docker build|docker pull" | grep -v grep)
|
`));
|
||||||
|
|
||||||
if [ -z "$PROCESSES" ]; then
|
|
||||||
echo "Docker is idle. Starting cleanup..."
|
|
||||||
break
|
|
||||||
else
|
|
||||||
echo "Docker is busy. Will check again in $CHECK_INTERVAL seconds..."
|
|
||||||
sleep $CHECK_INTERVAL
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
${cleanupImages}
|
|
||||||
${cleanupVolumes}
|
|
||||||
${cleanupContainers}
|
|
||||||
${cleanupSystem}
|
|
||||||
${cleanupBuilder}
|
|
||||||
|
|
||||||
echo "Docker cleanup completed."
|
|
||||||
`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
await execAsync(`
|
|
||||||
CHECK_INTERVAL=10
|
|
||||||
|
|
||||||
echo "Starting Docker cleanup..."
|
await execAsync(
|
||||||
|
dockerSafeExec(`
|
||||||
while true; do
|
${cleanupImages}
|
||||||
PROCESSES=$(ps aux | grep -E "docker build|docker pull" | grep -v grep)
|
${cleanupVolumes}
|
||||||
|
${cleanupContainers}
|
||||||
if [ -z "$PROCESSES" ]; then
|
${cleanupSystem}
|
||||||
echo "Docker is idle. Starting cleanup..."
|
${cleanupBuilder}
|
||||||
break
|
`)
|
||||||
else
|
);
|
||||||
echo "Docker is busy. Will check again in $CHECK_INTERVAL seconds..."
|
|
||||||
sleep $CHECK_INTERVAL
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
${cleanupImages}
|
|
||||||
${cleanupVolumes}
|
|
||||||
${cleanupContainers}
|
|
||||||
${cleanupSystem}
|
|
||||||
${cleanupBuilder}
|
|
||||||
|
|
||||||
echo "Docker cleanup completed."
|
|
||||||
`);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user