24 lines
1.3 KiB
JavaScript
Executable File
24 lines
1.3 KiB
JavaScript
Executable File
import { execFileSync } from 'node:child_process';
|
|
|
|
const containerArgs = ['create', '--network', 'none', '--entrypoint', 'node', 'wikideck-monero-mtls-test',
|
|
'--experimental-strip-types', 'scripts/monero-mtls-stagenet-rehearsal.mjs', '/opt/monero/monero-wallet-rpc'];
|
|
const containerId = execFileSync('docker', containerArgs, { encoding: 'utf8' }).trim();
|
|
if (!/^[a-f0-9]{64}$/.test(containerId)) throw new Error('Docker returned an invalid rehearsal container identity');
|
|
|
|
let exitCode = 1;
|
|
try {
|
|
execFileSync('docker', ['cp', 'Z:\\Repositories\\wikideck\\server', `${containerId}:/app/`], { stdio: 'inherit' });
|
|
execFileSync('docker', ['cp', 'Z:\\Repositories\\wikideck\\shared', `${containerId}:/app/`], { stdio: 'inherit' });
|
|
execFileSync('docker', ['cp', 'Z:\\Repositories\\wikideck\\scripts\\monero-mtls-stagenet-rehearsal.mjs',
|
|
`${containerId}:/app/scripts/monero-mtls-stagenet-rehearsal.mjs`], { stdio: 'inherit' });
|
|
try {
|
|
execFileSync('docker', ['start', '--attach', containerId], { stdio: 'inherit' });
|
|
exitCode = 0;
|
|
} catch (error) {
|
|
exitCode = typeof error.status === 'number' ? error.status : 1;
|
|
}
|
|
} finally {
|
|
execFileSync('docker', ['rm', '--force', containerId], { stdio: 'ignore' });
|
|
}
|
|
process.exitCode = exitCode;
|