-
-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathgulpfile.js
74 lines (70 loc) · 3 KB
/
gulpfile.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import fs from 'fs';
import gulp from 'gulp';
import shell from 'gulp-shell';
let minify = true;
let watch = false;
const PublicFiles = ["./public/**/*.*", "./public.template/**/*.*"];
const publicdestination = "./dist/public";
let version = "0.0.1";
if (fs.existsSync("../package.json")) {
let json1 = fs.readFileSync("../package.json");
var p1 = JSON.parse(json1);
version = p1.version;
} else if (fs.existsSync("package.json")) {
let json2 = fs.readFileSync("package.json");
var p2 = JSON.parse(json2);
version = p2.version;
}
gulp.task("copyfiles1", function () {
console.log("copyfiles1")
const base = gulp.src(PublicFiles).pipe(gulp.dest(publicdestination));
return base;
});
gulp.task("setwatch", async function () {
fs.mkdirSync(publicdestination, { recursive: true });
minify = false;
watch = true;
});
gulp.task("dowatch", function () {
console.log("watch")
return gulp.watch(PublicFiles
.concat('./public/**/*.*')
.concat('./src/proto/**/*.*')
, gulp.series("copyfiles1"));
});
gulp.task("filewatch", function () {
console.log("watch")
return gulp.watch(PublicFiles
.concat('./public/**/*.*')
.concat('./src/proto/**/*.*')
, gulp.series( "copyfiles1"));
});
// // docker buildx create --name openiap --use
// // docker buildx use default
// // docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -t openiap/openflow:edge .
gulp.task("compose", async function (done) {
var versions = ["-t openiap/openflow:edge", "-t openiap/openflow:" + version]
const dotCount = version.split('.').length - 1;
if(dotCount == 3){
let majorversion = version.substring(0, version.lastIndexOf('.'));
versions.push("-t openiap/openflow:" + majorversion);
}
console.log(versions)
return shell.task([`docker buildx build ${versions.join(" ")} --platform linux/amd64 --push .`])();
// return shell.task([`docker buildx build ${versions.join(" ")} --platform linux/amd64,linux/arm64,linux/arm/v7 --push .`])();
// return shell.task([`docker buildx build ${versions.join(" ")} --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 --push .`])();
// return shell.task([`docker buildx build ${versions.join(" ")} --platform linux/arm64 --push .`])();
});
gulp.task("latest", async function (done) {
var versions = ["-t openiap/openflow:latest", "-t openiap/openflow:edge", "-t openiap/openflow:" + version]
const dotCount = version.split('.').length - 1;
if(dotCount == 3){
let majorversion = version.substring(0, version.lastIndexOf('.'));
versions.push("-t openiap/openflow:" + majorversion);
}
console.log(versions)
return shell.task([`docker buildx build ${versions.join(" ")} --platform linux/amd64,linux/arm64,linux/arm/v7 --push .`])();
});
gulp.task("build", gulp.series("copyfiles1"));
gulp.task("watch", gulp.series("setwatch", "copyfiles1", "dowatch"));
gulp.task("default", gulp.series("copyfiles1"));