2022-02-10 15:47:44 +01:00
|
|
|
import { dev } from '$app/env';
|
|
|
|
import { asyncExecShell, getEngine } from '$lib/common';
|
|
|
|
import { prisma } from '$lib/database';
|
|
|
|
|
|
|
|
export default async function () {
|
|
|
|
if (!dev) {
|
|
|
|
const destinationDockers = await prisma.destinationDocker.findMany();
|
|
|
|
for (const destinationDocker of destinationDockers) {
|
|
|
|
const host = getEngine(destinationDocker.engine);
|
|
|
|
try {
|
2022-02-11 11:46:47 +01:00
|
|
|
// await asyncExecShell(`DOCKER_HOST=${host} docker container prune -f`);
|
2022-02-10 15:47:44 +01:00
|
|
|
} catch (error) {
|
|
|
|
//
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
try {
|
2022-02-11 11:46:47 +01:00
|
|
|
// await asyncExecShell(`DOCKER_HOST=${host} docker image prune -f`);
|
2022-02-10 15:47:44 +01:00
|
|
|
} catch (error) {
|
|
|
|
//
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|