podkeeper 0.5.0 → 0.6.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/lib/dockerApi.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import http from "http";
2
- const DOCKER_API_VERSION = "1.41";
2
+ const DOCKER_API_VERSION = "1.44";
3
3
  async function listContainers() {
4
4
  const containers = await getJSON("/containers/json") ?? [];
5
5
  return containers.map((container) => ({
@@ -34,7 +34,7 @@ class GenericService {
34
34
  const entrypoint = ["/deadmanswitch"];
35
35
  const command = [metadata.Config.Entrypoint, options.command ?? metadata.Config.Cmd].flat();
36
36
  const deadmanswitchName = imageArch === "arm64" ? "deadmanswitch_linux_aarch64" : "deadmanswitch_linux_x86_64";
37
- const usedPorts = new Set(options.ports.map((port) => port.container));
37
+ const usedPorts = new Set((options.ports ?? []).map((port) => port.container));
38
38
  let switchPort = 54321;
39
39
  while (usedPorts.has(switchPort))
40
40
  ++switchPort;
@@ -42,10 +42,11 @@ class GenericService {
42
42
  imageId: image.imageId,
43
43
  autoRemove: true,
44
44
  binds: [
45
+ ...options.binds ?? [],
45
46
  { containerPath: "/deadmanswitch", hostPath: path.join(__dirname, "..", "deadmanswitch", "bin", deadmanswitchName) }
46
47
  ],
47
48
  ports: [
48
- ...options.ports,
49
+ ...options.ports ?? [],
49
50
  { container: switchPort, host: 0 }
50
51
  ],
51
52
  entrypoint,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "podkeeper",
3
3
  "type": "module",
4
- "version": "0.5.0",
4
+ "version": "0.6.0",
5
5
  "description": "",
6
6
  "exports": {
7
7
  ".": {
@@ -6,10 +6,14 @@ export declare class GenericService {
6
6
  private _ws;
7
7
  static start(options: {
8
8
  imageName: string;
9
- ports: {
9
+ ports?: {
10
10
  host: number;
11
11
  container: number;
12
12
  }[];
13
+ binds?: {
14
+ hostPath: string;
15
+ containerPath: string;
16
+ }[];
13
17
  healthcheck?: {
14
18
  test: string[];
15
19
  intervalMs: number;