This commit is contained in:
Rizky 2024-01-25 16:20:57 +07:00
parent 994ba5e608
commit 0b799c24b0
2 changed files with 41 additions and 39 deletions

BIN
dockerzip

Binary file not shown.

View File

@ -1,14 +1,12 @@
import { $ } from "execa"; import { $ } from "execa";
import fs from "fs"; import fs from "fs";
import { import { copyAsync, dirAsync, existsAsync, removeAsync } from "fs-jetpack";
copyAsync,
dirAsync,
existsAsync,
removeAsync
} from "fs-jetpack";
import path from "path"; import path from "path";
const dir = { const g = global as any;
if (!g.dockerPrepared) {
g.dockerPrepared = true;
const dir = {
path(...allpath: any[]) { path(...allpath: any[]) {
return path.join(process.cwd(), ...allpath); return path.join(process.cwd(), ...allpath);
}, },
@ -34,9 +32,9 @@ const dir = {
return result; return result;
}, },
}; };
if (!(await existsAsync(dir.path("_tmp_docker")))) { if (!(await existsAsync(dir.path("_tmp_docker")))) {
for (const file of Object.keys(dir.read(dir.path``))) { for (const file of Object.keys(dir.read(dir.path``))) {
if (file.endsWith("package.json")) { if (file.endsWith("package.json")) {
await dirAsync(dir.path("_tmp_docker", path.dirname(file))); await dirAsync(dir.path("_tmp_docker", path.dirname(file)));
@ -45,9 +43,13 @@ if (!(await existsAsync(dir.path("_tmp_docker")))) {
}); });
} }
} }
await copyAsync(dir.path("bun.lockb"), dir.path("_tmp_docker", "bun.lockb")); await copyAsync(
dir.path("bun.lockb"),
dir.path("_tmp_docker", "bun.lockb")
);
await $({ cwd: dir.path("_tmp_docker") })`zip -r ../docker .`; await $({ cwd: dir.path("_tmp_docker") })`zip -r ../docker .`;
await $`mv docker.zip dockerzip`; await $`mv docker.zip dockerzip`;
await removeAsync(dir.path("_tmp_docker")); await removeAsync(dir.path("_tmp_docker"));
}
} }