forked from rsksmart/rootstock-integration-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunWithDocker.js
More file actions
25 lines (18 loc) · 935 Bytes
/
runWithDocker.js
File metadata and controls
25 lines (18 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
require('dotenv').config();
const jarPath = process.env.POWPEG_NODE_JAR_PATH;
const removeContainerAfterExecution = process.env.DOCKER_REMOVE_CONTAINER_AFTER_EXECUTION === 'true';
const removeContainerAfterExecutionFlag = removeContainerAfterExecution ? '--rm' : '';
if (jarPath) {
const destPath = path.join(__dirname, 'federate-node.jar');
console.log(`Copying JAR from ${jarPath} to ${destPath}`);
fs.copyFileSync(jarPath, destPath);
} else {
console.log("POWPEG_NODE_JAR_PATH is not set. Skipping file copy.");
}
console.log("Building Docker image...");
execSync('docker buildx build --platform linux/amd64 -t rits .', { stdio: 'inherit' });
console.log("Running Docker container...");
execSync(`docker run --name rits --platform linux/amd64 -it ${removeContainerAfterExecutionFlag} rits`, { stdio: 'inherit' });