mirror of
https://github.com/ershisan99/coolify.git
synced 2026-01-04 12:33:47 +00:00
v1.0.20 (#65)
This commit is contained in:
25
src/routes/api/v1/servers/cleanups/images.ts
Normal file
25
src/routes/api/v1/servers/cleanups/images.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { saveServerLog } from '$lib/api/applications/logging';
|
||||
import { execShellAsync } from '$lib/api/common';
|
||||
import type { Request } from '@sveltejs/kit';
|
||||
|
||||
|
||||
export async function post(request: Request) {
|
||||
try {
|
||||
const output = await execShellAsync('docker image prune -af')
|
||||
return {
|
||||
status: 200,
|
||||
body: {
|
||||
message: 'OK',
|
||||
output: output.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"").split('\n').pop()
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
await saveServerLog(error);
|
||||
return {
|
||||
status: 500,
|
||||
body: {
|
||||
error: error.message || error
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user