Skip to content

Commit 1fee9b1

Browse files
committed
improve package-lock handling for the docker build process
1 parent d368e07 commit 1fee9b1

File tree

2 files changed

+19
-28
lines changed

2 files changed

+19
-28
lines changed

docker-rebuild.js

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ const rimraf = require('rimraf');
88
let args = process.argv.length<=2 ? [] : process.argv.slice(2,process.argv.length);
99

1010
let frameworks = args.filter(a => !a.startsWith("--"));
11-
let justCopyAndBuild = args.some(f => f=="--justCopyAndBuild")
12-
13-
console.log("justCopyAndBuild", justCopyAndBuild);
1411

1512
if (frameworks.length==0) {
1613
console.log("ERROR: Missing arguments. Command: docker-rebuild keyed/framework1 non-keyed/framework2 ...");
@@ -31,29 +28,22 @@ for (f of frameworks) {
3128
}
3229
let [keyed,name] = components;
3330
let path = `frameworks/${keyed}/${name}`
34-
if (justCopyAndBuild) {
35-
rsync(keyed,name);
36-
exec('npm run build-prod', {
37-
cwd: path,
38-
stdio: 'inherit'
39-
});
40-
} else {
41-
if (fs.existsSync(path)) {
42-
console.log("deleting folder ",path);
43-
exec(`rm -r ${path}`);
44-
}
45-
rsync(keyed,name);
46-
exec('rm -rf package-lock.json yarn.lock dist elm-stuff bower_components node_modules', {
47-
cwd: path,
48-
stdio: 'inherit'
49-
});
50-
console.log("running npm install && npm run build-prod");
51-
exec('npm install && npm run build-prod', {
52-
cwd: path,
53-
stdio: 'inherit'
54-
});
55-
56-
}
31+
if (fs.existsSync(path)) {
32+
console.log("deleting folder ",path);
33+
exec(`rm -r ${path}`);
34+
}
35+
rsync(keyed,name);
36+
exec('rm -rf package-lock.json yarn.lock dist elm-stuff bower_components node_modules output', {
37+
cwd: path,
38+
stdio: 'inherit'
39+
});
40+
console.log("running npm install && npm run build-prod");
41+
exec('npm install && npm run build-prod', {
42+
cwd: path,
43+
stdio: 'inherit'
44+
});
45+
let packageLockPath = path+"/package-lock.json";
46+
fs.copyFileSync(packageLockPath, "/src/"+packageLockPath)
5747
}
5848

5949
let frameworkNames = frameworks.join(" ");

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"docker-build-image": "docker build -t js-framework-benchmark-ubuntu -f Dockerfile .",
1919
"docker-start": "cross-env-shell docker run --rm -d -p 8080:8080 --name js-framework-benchmark --volume ${INIT_CWD}:/src --volume js-framework-benchmark:/build js-framework-benchmark-ubuntu",
2020
"docker-stop": "docker stop js-framework-benchmark",
21-
"docker-sync": "docker exec -it js-framework-benchmark rsync -avC --exclude /index.html --exclude /framework/**/dist --exclude /webdriver-ts*/dist --exclude package-lock.json --exclude node_modules --exclude /webdriver-ts/results*/ /src/ /build/",
22-
"docker-build-frameworks": "npm run docker-sync && docker exec -it js-framework-benchmark npm install && docker exec -it js-framework-benchmark node build.js",
21+
"docker-sync": "docker exec -it js-framework-benchmark rsync -avC --exclude /index.html --exclude /framework/**/dist --exclude /webdriver-ts*/dist --exclude node_modules --exclude /webdriver-ts/results*/ /src/ /build/",
22+
"docker-sync-package-lock-back": "docker exec -it js-framework-benchmark bash sync-package-lock.sh",
23+
"docker-build-frameworks": "npm run docker-sync && docker exec -it js-framework-benchmark npm install && docker exec -it js-framework-benchmark node docker-rebuil-all.js",
2324
"docker-install-webdriver": "npm run docker-sync && docker exec -it js-framework-benchmark npm run install-local",
2425
"docker-create-index": "docker exec -it -w /build/webdriver-ts js-framework-benchmark npm run index",
2526
"docker-rebuild": "docker exec -it js-framework-benchmark cp /src/docker-rebuild.js /build/ && docker exec -it js-framework-benchmark node docker-rebuild.js",

0 commit comments

Comments
 (0)