@rpcbase/server 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/run_docker.js +19 -5
- package/package.json +1 -1
package/cli/run_docker.js
CHANGED
|
@@ -10,15 +10,26 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
|
|
|
10
10
|
// env
|
|
11
11
|
const env_path = path.relative(infrastructure_dir, path.join(process.cwd(), "./.env"))
|
|
12
12
|
|
|
13
|
+
const exists = (f) => {
|
|
14
|
+
const target_path = path.join(infrastructure_dir, f)
|
|
15
|
+
return fs.existsSync(target_path)
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
// compose files
|
|
14
19
|
const compose_files = ["-f", "common.yml"]
|
|
15
|
-
|
|
20
|
+
// TODO: which files are loaded and when should be documented
|
|
21
|
+
if (!is_native && exists("native.yml")) {
|
|
16
22
|
compose_files.push("-f", "native.yml")
|
|
17
23
|
}
|
|
18
|
-
if (is_production) {
|
|
24
|
+
if (!is_native && !is_production && exists("native.dev.yml")) {
|
|
25
|
+
compose_files.push("-f", "native.dev.yml")
|
|
26
|
+
}
|
|
27
|
+
if (is_production && exists("prod.yml")) {
|
|
19
28
|
compose_files.push("-f", "prod.yml")
|
|
20
29
|
}
|
|
21
|
-
|
|
30
|
+
if (!is_production && exists("dev.yml")) {
|
|
31
|
+
compose_files.push("-f", "dev.yml")
|
|
32
|
+
}
|
|
22
33
|
|
|
23
34
|
const opts = ["--build", "--remove-orphans"]
|
|
24
35
|
if (!is_production) opts.push("--abort-on-container-exit")
|
|
@@ -29,6 +40,9 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
|
|
|
29
40
|
|
|
30
41
|
console.log(cmd_args.join(" "))
|
|
31
42
|
|
|
43
|
+
// trim extra docker spaces
|
|
44
|
+
const fmt_line = (line) => line.replace(" |", "")
|
|
45
|
+
|
|
32
46
|
const ps = spawn(cmd, cmd_args, {cwd: infrastructure_dir})
|
|
33
47
|
ps.stdout.on("data", (data) => {
|
|
34
48
|
const lines = data.toString().split("\n")
|
|
@@ -36,7 +50,7 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
|
|
|
36
50
|
if (line.trim() === "") {
|
|
37
51
|
return
|
|
38
52
|
}
|
|
39
|
-
process.stdout.write(`${chalk.cyan("docker")}: ${line}\n`)
|
|
53
|
+
process.stdout.write(`${chalk.cyan("docker")}: ${fmt_line(line)}\n`)
|
|
40
54
|
})
|
|
41
55
|
})
|
|
42
56
|
|
|
@@ -46,7 +60,7 @@ const run_docker = async(infrastructure_dir, proj_prefix, is_native) => {
|
|
|
46
60
|
if (line.trim() === "") {
|
|
47
61
|
return
|
|
48
62
|
}
|
|
49
|
-
process.stdout.write(`${chalk.cyan("docker")}: ${chalk.yellow(line)}\n`)
|
|
63
|
+
process.stdout.write(`${chalk.cyan("docker")}: ${chalk.yellow(fmt_line(line))}\n`)
|
|
50
64
|
})
|
|
51
65
|
})
|
|
52
66
|
|