switch to nspawn proxy

This commit is contained in:
JOLIMAITRE Matthieu 2023-12-11 00:18:21 +01:00
parent 36891699c4
commit b1ee328238
2 changed files with 13 additions and 10 deletions

View file

@ -7,6 +7,7 @@ const log = log_from("nspawn");
export function container_command(name: string, directory: string, opts?: {
veth?: boolean;
boot?: boolean;
ports?: [number, number][];
cmd_opts?: Deno.CommandOptions;
}) {
const args = [
@ -15,6 +16,7 @@ export function container_command(name: string, directory: string, opts?: {
];
if (opts?.veth ?? false) args.push("--network-veth");
if (opts?.boot ?? false) args.push("--boot");
for (const [from, to] of opts?.ports ?? []) args.push(`--port=${from}:${to}`);
const command = new Deno.Command("systemd-nspawn", { ...opts?.cmd_opts, args });
return command;
}