testcontainers 11.11.0 → 11.13.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.
Files changed (192) hide show
  1. package/build/common/clock.js +0 -1
  2. package/build/common/file-lock.js +0 -1
  3. package/build/common/hash.js +0 -1
  4. package/build/common/index.js +0 -1
  5. package/build/common/logger.js +0 -1
  6. package/build/common/retry.js +0 -1
  7. package/build/common/streams.js +0 -1
  8. package/build/common/time.js +0 -1
  9. package/build/common/type-guards.js +0 -1
  10. package/build/common/uuid.js +0 -1
  11. package/build/container-runtime/auth/auths.js +0 -1
  12. package/build/container-runtime/auth/cred-helpers.js +0 -1
  13. package/build/container-runtime/auth/credential-provider.js +0 -1
  14. package/build/container-runtime/auth/creds-store.js +0 -1
  15. package/build/container-runtime/auth/get-auth-config.js +0 -1
  16. package/build/container-runtime/auth/registry-auth-locator.js +0 -1
  17. package/build/container-runtime/auth/registry-matches.js +0 -1
  18. package/build/container-runtime/auth/types.js +0 -1
  19. package/build/container-runtime/clients/client.js +0 -1
  20. package/build/container-runtime/clients/compose/compose-client.js +0 -1
  21. package/build/container-runtime/clients/compose/default-compose-options.js +0 -1
  22. package/build/container-runtime/clients/compose/parse-compose-container-name.js +2 -3
  23. package/build/container-runtime/clients/compose/types.js +0 -1
  24. package/build/container-runtime/clients/container/container-client.d.ts +2 -1
  25. package/build/container-runtime/clients/container/container-client.js +0 -1
  26. package/build/container-runtime/clients/container/docker-container-client.d.ts +2 -1
  27. package/build/container-runtime/clients/container/docker-container-client.js +6 -3
  28. package/build/container-runtime/clients/container/types.js +0 -1
  29. package/build/container-runtime/clients/image/docker-image-client.d.ts +3 -1
  30. package/build/container-runtime/clients/image/docker-image-client.js +36 -17
  31. package/build/container-runtime/clients/image/image-client.js +0 -1
  32. package/build/container-runtime/clients/network/docker-network-client.js +0 -1
  33. package/build/container-runtime/clients/network/network-client.js +0 -1
  34. package/build/container-runtime/clients/types.js +0 -1
  35. package/build/container-runtime/image-name.js +0 -1
  36. package/build/container-runtime/index.js +0 -1
  37. package/build/container-runtime/strategies/configuration-strategy.js +0 -1
  38. package/build/container-runtime/strategies/npipe-socket-strategy.js +0 -1
  39. package/build/container-runtime/strategies/rootless-unix-socket-strategy.js +0 -1
  40. package/build/container-runtime/strategies/strategy.js +0 -1
  41. package/build/container-runtime/strategies/testcontainers-host-strategy.js +0 -1
  42. package/build/container-runtime/strategies/types.js +0 -1
  43. package/build/container-runtime/strategies/unix-socket-strategy.js +0 -1
  44. package/build/container-runtime/strategies/utils/config.js +1 -2
  45. package/build/container-runtime/utils/attach-container.js +0 -1
  46. package/build/container-runtime/utils/demux-stream.js +0 -1
  47. package/build/container-runtime/utils/image-exists.js +0 -1
  48. package/build/container-runtime/utils/lookup-host-ips.js +0 -1
  49. package/build/container-runtime/utils/pull-image.js +0 -1
  50. package/build/container-runtime/utils/remote-container-runtime-socket-path.js +0 -1
  51. package/build/container-runtime/utils/resolve-host.js +0 -1
  52. package/build/container-runtime/utils/run-in-container.js +0 -1
  53. package/build/container-runtime/utils/start-container.js +0 -1
  54. package/build/docker-compose-environment/docker-compose-environment.d.ts +1 -0
  55. package/build/docker-compose-environment/docker-compose-environment.js +8 -1
  56. package/build/docker-compose-environment/downed-docker-compose-environment.js +0 -1
  57. package/build/docker-compose-environment/started-docker-compose-environment.js +0 -1
  58. package/build/docker-compose-environment/stopped-docker-compose-environment.js +0 -1
  59. package/build/generic-container/abstract-started-container.d.ts +2 -2
  60. package/build/generic-container/abstract-started-container.js +2 -3
  61. package/build/generic-container/abstract-stopped-container.js +0 -1
  62. package/build/generic-container/generic-container-builder.js +0 -1
  63. package/build/generic-container/generic-container.d.ts +4 -1
  64. package/build/generic-container/generic-container.js +23 -7
  65. package/build/generic-container/inspect-container-util-ports-exposed.js +0 -1
  66. package/build/generic-container/started-generic-container.d.ts +2 -2
  67. package/build/generic-container/started-generic-container.js +8 -4
  68. package/build/generic-container/stopped-generic-container.js +0 -1
  69. package/build/index.d.ts +1 -1
  70. package/build/index.js +0 -1
  71. package/build/network/network.js +0 -1
  72. package/build/port-forwarder/port-forwarder.js +0 -1
  73. package/build/reaper/reaper.js +21 -11
  74. package/build/socat/socat-container.js +0 -1
  75. package/build/test-container.d.ts +4 -2
  76. package/build/test-container.js +0 -1
  77. package/build/test-containers.js +0 -1
  78. package/build/types.d.ts +14 -0
  79. package/build/types.js +0 -1
  80. package/build/utils/bound-ports.js +0 -1
  81. package/build/utils/dockerfile-parser.js +0 -1
  82. package/build/utils/labels.js +0 -1
  83. package/build/utils/map-inspect-result.js +0 -1
  84. package/build/utils/port-generator.js +0 -1
  85. package/build/utils/port.js +0 -1
  86. package/build/utils/pull-policy.js +0 -1
  87. package/build/version.d.ts +1 -1
  88. package/build/version.js +1 -2
  89. package/build/wait-strategies/composite-wait-strategy.js +0 -1
  90. package/build/wait-strategies/health-check-wait-strategy.js +0 -1
  91. package/build/wait-strategies/host-port-wait-strategy.js +0 -1
  92. package/build/wait-strategies/http-wait-strategy.js +0 -1
  93. package/build/wait-strategies/log-wait-strategy.js +0 -1
  94. package/build/wait-strategies/one-shot-startup-startegy.js +0 -1
  95. package/build/wait-strategies/shell-wait-strategy.js +0 -1
  96. package/build/wait-strategies/startup-check-strategy.js +0 -1
  97. package/build/wait-strategies/utils/port-check.js +0 -1
  98. package/build/wait-strategies/utils/undici-response-parser.js +0 -1
  99. package/build/wait-strategies/wait-for-container.js +0 -1
  100. package/build/wait-strategies/wait-strategy.js +0 -1
  101. package/build/wait-strategies/wait.js +0 -1
  102. package/package.json +6 -6
  103. package/build/common/clock.js.map +0 -1
  104. package/build/common/file-lock.js.map +0 -1
  105. package/build/common/hash.js.map +0 -1
  106. package/build/common/index.js.map +0 -1
  107. package/build/common/logger.js.map +0 -1
  108. package/build/common/retry.js.map +0 -1
  109. package/build/common/streams.js.map +0 -1
  110. package/build/common/time.js.map +0 -1
  111. package/build/common/type-guards.js.map +0 -1
  112. package/build/common/uuid.js.map +0 -1
  113. package/build/container-runtime/auth/auths.js.map +0 -1
  114. package/build/container-runtime/auth/cred-helpers.js.map +0 -1
  115. package/build/container-runtime/auth/credential-provider.js.map +0 -1
  116. package/build/container-runtime/auth/creds-store.js.map +0 -1
  117. package/build/container-runtime/auth/get-auth-config.js.map +0 -1
  118. package/build/container-runtime/auth/registry-auth-locator.js.map +0 -1
  119. package/build/container-runtime/auth/registry-matches.js.map +0 -1
  120. package/build/container-runtime/auth/types.js.map +0 -1
  121. package/build/container-runtime/clients/client.js.map +0 -1
  122. package/build/container-runtime/clients/compose/compose-client.js.map +0 -1
  123. package/build/container-runtime/clients/compose/default-compose-options.js.map +0 -1
  124. package/build/container-runtime/clients/compose/parse-compose-container-name.js.map +0 -1
  125. package/build/container-runtime/clients/compose/types.js.map +0 -1
  126. package/build/container-runtime/clients/container/container-client.js.map +0 -1
  127. package/build/container-runtime/clients/container/docker-container-client.js.map +0 -1
  128. package/build/container-runtime/clients/container/types.js.map +0 -1
  129. package/build/container-runtime/clients/image/docker-image-client.js.map +0 -1
  130. package/build/container-runtime/clients/image/image-client.js.map +0 -1
  131. package/build/container-runtime/clients/network/docker-network-client.js.map +0 -1
  132. package/build/container-runtime/clients/network/network-client.js.map +0 -1
  133. package/build/container-runtime/clients/types.js.map +0 -1
  134. package/build/container-runtime/image-name.js.map +0 -1
  135. package/build/container-runtime/index.js.map +0 -1
  136. package/build/container-runtime/strategies/configuration-strategy.js.map +0 -1
  137. package/build/container-runtime/strategies/npipe-socket-strategy.js.map +0 -1
  138. package/build/container-runtime/strategies/rootless-unix-socket-strategy.js.map +0 -1
  139. package/build/container-runtime/strategies/strategy.js.map +0 -1
  140. package/build/container-runtime/strategies/testcontainers-host-strategy.js.map +0 -1
  141. package/build/container-runtime/strategies/types.js.map +0 -1
  142. package/build/container-runtime/strategies/unix-socket-strategy.js.map +0 -1
  143. package/build/container-runtime/strategies/utils/config.js.map +0 -1
  144. package/build/container-runtime/utils/attach-container.js.map +0 -1
  145. package/build/container-runtime/utils/demux-stream.js.map +0 -1
  146. package/build/container-runtime/utils/image-exists.js.map +0 -1
  147. package/build/container-runtime/utils/lookup-host-ips.js.map +0 -1
  148. package/build/container-runtime/utils/pull-image.js.map +0 -1
  149. package/build/container-runtime/utils/remote-container-runtime-socket-path.js.map +0 -1
  150. package/build/container-runtime/utils/resolve-host.js.map +0 -1
  151. package/build/container-runtime/utils/run-in-container.js.map +0 -1
  152. package/build/container-runtime/utils/start-container.js.map +0 -1
  153. package/build/docker-compose-environment/docker-compose-environment.js.map +0 -1
  154. package/build/docker-compose-environment/downed-docker-compose-environment.js.map +0 -1
  155. package/build/docker-compose-environment/started-docker-compose-environment.js.map +0 -1
  156. package/build/docker-compose-environment/stopped-docker-compose-environment.js.map +0 -1
  157. package/build/generic-container/abstract-started-container.js.map +0 -1
  158. package/build/generic-container/abstract-stopped-container.js.map +0 -1
  159. package/build/generic-container/generic-container-builder.js.map +0 -1
  160. package/build/generic-container/generic-container.js.map +0 -1
  161. package/build/generic-container/inspect-container-util-ports-exposed.js.map +0 -1
  162. package/build/generic-container/started-generic-container.js.map +0 -1
  163. package/build/generic-container/stopped-generic-container.js.map +0 -1
  164. package/build/index.js.map +0 -1
  165. package/build/network/network.js.map +0 -1
  166. package/build/port-forwarder/port-forwarder.js.map +0 -1
  167. package/build/reaper/reaper.js.map +0 -1
  168. package/build/socat/socat-container.js.map +0 -1
  169. package/build/test-container.js.map +0 -1
  170. package/build/test-containers.js.map +0 -1
  171. package/build/types.js.map +0 -1
  172. package/build/utils/bound-ports.js.map +0 -1
  173. package/build/utils/dockerfile-parser.js.map +0 -1
  174. package/build/utils/labels.js.map +0 -1
  175. package/build/utils/map-inspect-result.js.map +0 -1
  176. package/build/utils/port-generator.js.map +0 -1
  177. package/build/utils/port.js.map +0 -1
  178. package/build/utils/pull-policy.js.map +0 -1
  179. package/build/version.js.map +0 -1
  180. package/build/wait-strategies/composite-wait-strategy.js.map +0 -1
  181. package/build/wait-strategies/health-check-wait-strategy.js.map +0 -1
  182. package/build/wait-strategies/host-port-wait-strategy.js.map +0 -1
  183. package/build/wait-strategies/http-wait-strategy.js.map +0 -1
  184. package/build/wait-strategies/log-wait-strategy.js.map +0 -1
  185. package/build/wait-strategies/one-shot-startup-startegy.js.map +0 -1
  186. package/build/wait-strategies/shell-wait-strategy.js.map +0 -1
  187. package/build/wait-strategies/startup-check-strategy.js.map +0 -1
  188. package/build/wait-strategies/utils/port-check.js.map +0 -1
  189. package/build/wait-strategies/utils/undici-response-parser.js.map +0 -1
  190. package/build/wait-strategies/wait-for-container.js.map +0 -1
  191. package/build/wait-strategies/wait-strategy.js.map +0 -1
  192. package/build/wait-strategies/wait.js.map +0 -1
@@ -7,4 +7,3 @@ class SystemClock {
7
7
  }
8
8
  }
9
9
  exports.SystemClock = SystemClock;
10
- //# sourceMappingURL=clock.js.map
@@ -66,4 +66,3 @@ async function createEmptyTmpFile(fileName) {
66
66
  await (0, promises_1.writeFile)(file, "");
67
67
  return file;
68
68
  }
69
- //# sourceMappingURL=file-lock.js.map
@@ -8,4 +8,3 @@ const crypto_1 = __importDefault(require("crypto"));
8
8
  function hash(str) {
9
9
  return crypto_1.default.createHash("sha256").update(str).digest("hex");
10
10
  }
11
- //# sourceMappingURL=hash.js.map
@@ -36,4 +36,3 @@ __exportStar(require("./type-guards"), exports);
36
36
  var uuid_1 = require("./uuid");
37
37
  Object.defineProperty(exports, "RandomUuid", { enumerable: true, get: function () { return uuid_1.RandomUuid; } });
38
38
  Object.defineProperty(exports, "randomUuid", { enumerable: true, get: function () { return uuid_1.randomUuid; } });
39
- //# sourceMappingURL=index.js.map
@@ -54,4 +54,3 @@ exports.composeLog = new Logger("testcontainers:compose", false);
54
54
  exports.buildLog = new Logger("testcontainers:build", false);
55
55
  exports.pullLog = new Logger("testcontainers:pull", false);
56
56
  exports.execLog = new Logger("testcontainers:exec", false);
57
- //# sourceMappingURL=logger.js.map
@@ -35,4 +35,3 @@ class IntervalRetry extends AbstractRetry {
35
35
  }
36
36
  }
37
37
  exports.IntervalRetry = IntervalRetry;
38
- //# sourceMappingURL=retry.js.map
@@ -10,4 +10,3 @@ const streamToString = async (stream, options = { trim: false }) => {
10
10
  return options.trim ? str.trim() : str;
11
11
  };
12
12
  exports.streamToString = streamToString;
13
- //# sourceMappingURL=streams.js.map
@@ -5,4 +5,3 @@ const toSeconds = (ms) => Math.trunc(ms * 1e-3);
5
5
  exports.toSeconds = toSeconds;
6
6
  const toNanos = (ms) => ms * 1e6;
7
7
  exports.toNanos = toNanos;
8
- //# sourceMappingURL=time.js.map
@@ -7,4 +7,3 @@ const isEmptyString = (value) => value.trim() === "";
7
7
  exports.isEmptyString = isEmptyString;
8
8
  const isNotEmptyString = (value) => !(0, exports.isEmptyString)(value);
9
9
  exports.isNotEmptyString = isNotEmptyString;
10
- //# sourceMappingURL=type-guards.js.map
@@ -15,4 +15,3 @@ exports.RandomUuid = RandomUuid;
15
15
  const randomUuidGen = new RandomUuid();
16
16
  const randomUuid = () => randomUuidGen.nextUuid();
17
17
  exports.randomUuid = randomUuid;
18
- //# sourceMappingURL=uuid.js.map
@@ -49,4 +49,3 @@ class Auths {
49
49
  }
50
50
  }
51
51
  exports.Auths = Auths;
52
- //# sourceMappingURL=auths.js.map
@@ -13,4 +13,3 @@ class CredHelpers extends credential_provider_1.CredentialProvider {
13
13
  }
14
14
  }
15
15
  exports.CredHelpers = CredHelpers;
16
- //# sourceMappingURL=cred-helpers.js.map
@@ -59,4 +59,3 @@ class CredentialProvider {
59
59
  }
60
60
  }
61
61
  exports.CredentialProvider = CredentialProvider;
62
- //# sourceMappingURL=credential-provider.js.map
@@ -13,4 +13,3 @@ class CredsStore extends credential_provider_1.CredentialProvider {
13
13
  }
14
14
  }
15
15
  exports.CredsStore = CredsStore;
16
- //# sourceMappingURL=creds-store.js.map
@@ -54,4 +54,3 @@ const getAuthConfig = async (registry) => {
54
54
  return undefined;
55
55
  };
56
56
  exports.getAuthConfig = getAuthConfig;
57
- //# sourceMappingURL=get-auth-config.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=registry-auth-locator.js.map
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.registryMatches = void 0;
4
4
  const registryMatches = (authConfigRegistry, requestedRegistry) => authConfigRegistry == requestedRegistry || authConfigRegistry.endsWith("://" + requestedRegistry);
5
5
  exports.registryMatches = registryMatches;
6
- //# sourceMappingURL=registry-matches.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -117,4 +117,3 @@ async function initStrategy(strategy) {
117
117
  common_1.log.trace(`Container runtime info:\n${JSON.stringify(info, null, 2)}`);
118
118
  return new ContainerRuntimeClient(info, composeClient, containerClient, imageClient, networkClient);
119
119
  }
120
- //# sourceMappingURL=client.js.map
@@ -115,4 +115,3 @@ function composeDownCommandOptions(options) {
115
115
  }
116
116
  return result;
117
117
  }
118
- //# sourceMappingURL=compose-client.js.map
@@ -28,4 +28,3 @@ function defaultComposeOptions(environment, options) {
28
28
  executable: options.executable,
29
29
  };
30
30
  }
31
- //# sourceMappingURL=default-compose-options.js.map
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseComposeContainerName = parseComposeContainerName;
4
4
  function parseComposeContainerName(projectName, containerName) {
5
- if (containerName.includes(projectName)) {
6
- return containerName.substring(`/${projectName}_`.length);
5
+ if (containerName.startsWith(`/${projectName}-`)) {
6
+ return containerName.substring(`/${projectName}-`.length);
7
7
  }
8
8
  else if (containerName.startsWith("/")) {
9
9
  return containerName.substring(1);
@@ -12,4 +12,3 @@ function parseComposeContainerName(projectName, containerName) {
12
12
  throw new Error(`Unable to resolve container name for container name: "${containerName}", project name: "${projectName}"`);
13
13
  }
14
14
  }
15
- //# sourceMappingURL=parse-compose-container-name.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -1,5 +1,6 @@
1
1
  import Dockerode, { Container, ContainerCreateOptions, ContainerInfo, ContainerInspectInfo, ContainerLogsOptions, Network } from "dockerode";
2
2
  import { Readable } from "stream";
3
+ import { CopyToContainerOptions } from "../../../types";
3
4
  import { ContainerCommitOptions, ContainerStatus, ExecOptions, ExecResult } from "./types";
4
5
  export interface ContainerClient {
5
6
  dockerode: Dockerode;
@@ -8,7 +9,7 @@ export interface ContainerClient {
8
9
  status?: ContainerStatus[];
9
10
  }): Promise<Container | undefined>;
10
11
  fetchArchive(container: Container, path: string): Promise<NodeJS.ReadableStream>;
11
- putArchive(container: Dockerode.Container, stream: Readable, path: string): Promise<void>;
12
+ putArchive(container: Dockerode.Container, stream: Readable, path: string, options?: CopyToContainerOptions): Promise<void>;
12
13
  list(): Promise<ContainerInfo[]>;
13
14
  create(opts: ContainerCreateOptions): Promise<Container>;
14
15
  start(container: Container): Promise<void>;
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=container-client.js.map
@@ -1,5 +1,6 @@
1
1
  import Dockerode, { Container, ContainerCreateOptions, ContainerInfo, ContainerInspectInfo, ContainerLogsOptions, Network } from "dockerode";
2
2
  import { Readable } from "stream";
3
+ import { CopyToContainerOptions } from "../../../types";
3
4
  import { ContainerClient } from "./container-client";
4
5
  import { ContainerCommitOptions, ContainerStatus, ExecOptions, ExecResult } from "./types";
5
6
  export declare class DockerContainerClient implements ContainerClient {
@@ -10,7 +11,7 @@ export declare class DockerContainerClient implements ContainerClient {
10
11
  status?: ContainerStatus[];
11
12
  } | undefined): Promise<Container | undefined>;
12
13
  fetchArchive(container: Container, path: string): Promise<NodeJS.ReadableStream>;
13
- putArchive(container: Dockerode.Container, stream: Readable, path: string): Promise<void>;
14
+ putArchive(container: Dockerode.Container, stream: Readable, path: string, options?: CopyToContainerOptions): Promise<void>;
14
15
  list(): Promise<ContainerInfo[]>;
15
16
  create(opts: ContainerCreateOptions): Promise<Container>;
16
17
  start(container: Container): Promise<void>;
@@ -59,10 +59,14 @@ class DockerContainerClient {
59
59
  throw err;
60
60
  }
61
61
  }
62
- async putArchive(container, stream, path) {
62
+ async putArchive(container, stream, path, options) {
63
63
  try {
64
64
  common_1.log.debug(`Putting archive to container...`, { containerId: container.id });
65
- await (0, common_1.streamToString)(stream_1.Readable.from(await container.putArchive(stream, { path })));
65
+ await (0, common_1.streamToString)(stream_1.Readable.from(await container.putArchive(stream, {
66
+ path,
67
+ noOverwriteDirNonDir: options?.noOverwriteDirNonDir,
68
+ copyUIDGID: options?.copyUIDGID,
69
+ })));
66
70
  common_1.log.debug(`Put archive to container`, { containerId: container.id });
67
71
  }
68
72
  catch (err) {
@@ -312,4 +316,3 @@ class DockerContainerClient {
312
316
  }
313
317
  }
314
318
  exports.DockerContainerClient = DockerContainerClient;
315
- //# sourceMappingURL=docker-container-client.js.map
@@ -2,4 +2,3 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CONTAINER_STATUSES = void 0;
4
4
  exports.CONTAINER_STATUSES = ["created", "restarting", "running", "removing", "paused", "exited", "dead"];
5
- //# sourceMappingURL=types.js.map
@@ -8,7 +8,9 @@ export declare class DockerImageClient implements ImageClient {
8
8
  private readonly imageExistsLock;
9
9
  constructor(dockerode: Dockerode, indexServerAddress: string);
10
10
  build(context: string, opts: ImageBuildOptions): Promise<void>;
11
- private createIsDockerIgnoredFunction;
11
+ private createTarPackOptions;
12
+ private listContextEntries;
13
+ private normalizePathForDockerIgnore;
12
14
  inspect(imageName: ImageName): Promise<ImageInspectInfo>;
13
15
  exists(imageName: ImageName): Promise<boolean>;
14
16
  pull(imageName: ImageName, opts?: {
@@ -24,18 +24,8 @@ class DockerImageClient {
24
24
  async build(context, opts) {
25
25
  try {
26
26
  common_1.log.debug(`Building image "${opts.t}" with context "${context}"...`);
27
- const isDockerIgnored = await this.createIsDockerIgnoredFunction(context);
28
- const tarStream = tar_fs_1.default.pack(context, {
29
- ignore: (aPath) => {
30
- const relativePath = path_1.default.relative(context, aPath);
31
- if (relativePath === opts.dockerfile) {
32
- return false;
33
- }
34
- else {
35
- return isDockerIgnored(relativePath);
36
- }
37
- },
38
- });
27
+ const tarPackOptions = await this.createTarPackOptions(context, opts.dockerfile ?? "Dockerfile");
28
+ const tarStream = tar_fs_1.default.pack(context, tarPackOptions);
39
29
  await new Promise((resolve) => {
40
30
  this.dockerode
41
31
  .buildImage(tarStream, opts)
@@ -57,16 +47,46 @@ class DockerImageClient {
57
47
  throw err;
58
48
  }
59
49
  }
60
- async createIsDockerIgnoredFunction(context) {
50
+ async createTarPackOptions(context, dockerfileName) {
61
51
  const dockerIgnoreFilePath = path_1.default.join(context, ".dockerignore");
62
52
  if (!(0, fs_1.existsSync)(dockerIgnoreFilePath)) {
63
- return () => false;
53
+ return {};
64
54
  }
65
55
  const dockerIgnorePatterns = await fs_1.promises.readFile(dockerIgnoreFilePath, { encoding: "utf-8" });
66
56
  const instance = (0, dockerignore_1.default)({ ignorecase: false });
67
57
  instance.add(dockerIgnorePatterns);
68
- const filter = instance.createFilter();
69
- return (aPath) => !filter(aPath);
58
+ const allEntries = await this.listContextEntries(context);
59
+ const includedEntries = instance.filter(allEntries);
60
+ const dockerfilePath = this.normalizePathForDockerIgnore(path_1.default.normalize(dockerfileName));
61
+ if (!includedEntries.includes(dockerfilePath)) {
62
+ includedEntries.push(dockerfilePath);
63
+ }
64
+ return { entries: includedEntries };
65
+ }
66
+ async listContextEntries(context) {
67
+ const entries = [];
68
+ const directoriesToVisit = [""];
69
+ while (directoriesToVisit.length > 0) {
70
+ const directory = directoriesToVisit.pop();
71
+ if (directory === undefined) {
72
+ continue;
73
+ }
74
+ const absoluteDirectory = directory.length > 0 ? path_1.default.join(context, directory) : context;
75
+ const directoryEntries = await fs_1.promises.readdir(absoluteDirectory, { withFileTypes: true });
76
+ for (const directoryEntry of directoryEntries) {
77
+ const relativeEntry = directory.length > 0 ? path_1.default.join(directory, directoryEntry.name) : directoryEntry.name;
78
+ if (directoryEntry.isDirectory()) {
79
+ directoriesToVisit.push(relativeEntry);
80
+ }
81
+ else {
82
+ entries.push(this.normalizePathForDockerIgnore(relativeEntry));
83
+ }
84
+ }
85
+ }
86
+ return entries;
87
+ }
88
+ normalizePathForDockerIgnore(aPath) {
89
+ return aPath.replace(/\\/gu, "/");
70
90
  }
71
91
  async inspect(imageName) {
72
92
  try {
@@ -131,4 +151,3 @@ class DockerImageClient {
131
151
  }
132
152
  }
133
153
  exports.DockerImageClient = DockerImageClient;
134
- //# sourceMappingURL=docker-image-client.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=image-client.js.map
@@ -47,4 +47,3 @@ class DockerNetworkClient {
47
47
  }
48
48
  }
49
49
  exports.DockerNetworkClient = DockerNetworkClient;
50
- //# sourceMappingURL=docker-network-client.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=network-client.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -83,4 +83,3 @@ class ImageName {
83
83
  }
84
84
  }
85
85
  exports.ImageName = ImageName;
86
- //# sourceMappingURL=image-name.js.map
@@ -10,4 +10,3 @@ var parse_compose_container_name_1 = require("./clients/compose/parse-compose-co
10
10
  Object.defineProperty(exports, "parseComposeContainerName", { enumerable: true, get: function () { return parse_compose_container_name_1.parseComposeContainerName; } });
11
11
  var image_name_1 = require("./image-name");
12
12
  Object.defineProperty(exports, "ImageName", { enumerable: true, get: function () { return image_name_1.ImageName; } });
13
- //# sourceMappingURL=index.js.map
@@ -44,4 +44,3 @@ class ConfigurationStrategy {
44
44
  }
45
45
  }
46
46
  exports.ConfigurationStrategy = ConfigurationStrategy;
47
- //# sourceMappingURL=configuration-strategy.js.map
@@ -22,4 +22,3 @@ class NpipeSocketStrategy {
22
22
  }
23
23
  }
24
24
  exports.NpipeSocketStrategy = NpipeSocketStrategy;
25
- //# sourceMappingURL=npipe-socket-strategy.js.map
@@ -60,4 +60,3 @@ class RootlessUnixSocketStrategy {
60
60
  }
61
61
  }
62
62
  exports.RootlessUnixSocketStrategy = RootlessUnixSocketStrategy;
63
- //# sourceMappingURL=rootless-unix-socket-strategy.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=strategy.js.map
@@ -27,4 +27,3 @@ class TestcontainersHostStrategy {
27
27
  }
28
28
  }
29
29
  exports.TestcontainersHostStrategy = TestcontainersHostStrategy;
30
- //# sourceMappingURL=testcontainers-host-strategy.js.map
@@ -1,3 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
@@ -23,4 +23,3 @@ class UnixSocketStrategy {
23
23
  }
24
24
  }
25
25
  exports.UnixSocketStrategy = UnixSocketStrategy;
26
- //# sourceMappingURL=unix-socket-strategy.js.map
@@ -28,7 +28,7 @@ async function loadFromFile() {
28
28
  if ((0, fs_1.existsSync)(file)) {
29
29
  common_1.log.debug(`Loading ".testcontainers.properties" file...`);
30
30
  const string = await (0, promises_1.readFile)(file, { encoding: "utf-8" });
31
- const properties = (0, properties_reader_1.default)("").read(string);
31
+ const properties = (0, properties_reader_1.default)({ sourceFile: "" }).read(string);
32
32
  const tcHost = properties.get("tc.host");
33
33
  if (tcHost !== null) {
34
34
  dockerClientConfig.tcHost = tcHost;
@@ -73,4 +73,3 @@ function logDockerClientConfig(config) {
73
73
  common_1.log.debug(`Found custom configuration: ${configurations.join(", ")}`);
74
74
  }
75
75
  }
76
- //# sourceMappingURL=config.js.map
@@ -14,4 +14,3 @@ const attachContainer = async (dockerode, container) => {
14
14
  }
15
15
  };
16
16
  exports.attachContainer = attachContainer;
17
- //# sourceMappingURL=attach-container.js.map
@@ -20,4 +20,3 @@ async function demuxStream(dockerode, stream) {
20
20
  throw err;
21
21
  }
22
22
  }
23
- //# sourceMappingURL=demux-stream.js.map
@@ -25,4 +25,3 @@ async function imageExists(dockerode, imageName) {
25
25
  }
26
26
  });
27
27
  }
28
- //# sourceMappingURL=image-exists.js.map
@@ -15,4 +15,3 @@ const lookupHostIps = async (host) => {
15
15
  }
16
16
  };
17
17
  exports.lookupHostIps = lookupHostIps;
18
- //# sourceMappingURL=lookup-host-ips.js.map
@@ -32,4 +32,3 @@ const pullImage = async (dockerode, indexServerAddress, options) => {
32
32
  }
33
33
  };
34
34
  exports.pullImage = pullImage;
35
- //# sourceMappingURL=pull-image.js.map
@@ -20,4 +20,3 @@ const getRemoteContainerRuntimeSocketPath = (containerRuntimeStrategyResult, con
20
20
  return platform === "win32" ? `/${socketPath}` : socketPath;
21
21
  };
22
22
  exports.getRemoteContainerRuntimeSocketPath = getRemoteContainerRuntimeSocketPath;
23
- //# sourceMappingURL=remote-container-runtime-socket-path.js.map
@@ -51,4 +51,3 @@ const findDefaultGateway = async (dockerode, indexServerAddress) => {
51
51
  ]);
52
52
  };
53
53
  const isInContainer = () => (0, fs_1.existsSync)("/.dockerenv");
54
- //# sourceMappingURL=resolve-host.js.map
@@ -27,4 +27,3 @@ const runInContainer = async (dockerode, indexServerAddress, image, command) =>
27
27
  }
28
28
  };
29
29
  exports.runInContainer = runInContainer;
30
- //# sourceMappingURL=run-in-container.js.map
@@ -12,4 +12,3 @@ const startContainer = async (container) => {
12
12
  }
13
13
  };
14
14
  exports.startContainer = startContainer;
15
- //# sourceMappingURL=start-container.js.map
@@ -31,4 +31,5 @@ export declare class DockerComposeEnvironment {
31
31
  withProjectName(projectName: string): this;
32
32
  withClientOptions(options: Partial<Omit<ComposeOptions, "filePath" | "files" | "projectName" | "environment">>): this;
33
33
  up(services?: Array<string>): Promise<StartedDockerComposeEnvironment>;
34
+ private warnForUnusedWaitStrategies;
34
35
  }
@@ -114,6 +114,8 @@ class DockerComposeEnvironment {
114
114
  startedContainer.Names.join(", "),
115
115
  ], []);
116
116
  common_1.log.info(`Started containers "${startedContainerNames.join('", "')}"`);
117
+ const startedContainerNameSet = new Set(startedContainers.map((startedContainer) => (0, container_runtime_1.parseComposeContainerName)(this.projectName, startedContainer.Names[0])));
118
+ this.warnForUnusedWaitStrategies(startedContainerNameSet);
117
119
  const startedGenericContainers = (await Promise.all(startedContainers.map(async (startedContainer) => {
118
120
  const container = client.container.getById(startedContainer.Id);
119
121
  const containerName = (0, container_runtime_1.parseComposeContainerName)(this.projectName, startedContainer.Names[0]);
@@ -155,6 +157,11 @@ class DockerComposeEnvironment {
155
157
  environment: this.environment,
156
158
  });
157
159
  }
160
+ warnForUnusedWaitStrategies(startedContainerNames) {
161
+ const unusedWaitStrategyContainerNames = Object.keys(this.waitStrategy).filter((configuredContainerName) => !startedContainerNames.has(configuredContainerName));
162
+ if (unusedWaitStrategyContainerNames.length > 0) {
163
+ common_1.log.warn(`No containers were started for the configured wait strategy names: "${unusedWaitStrategyContainerNames.join('", "')}". Wait strategies are matched against container names (for example "redis-1"), not service names.`);
164
+ }
165
+ }
158
166
  }
159
167
  exports.DockerComposeEnvironment = DockerComposeEnvironment;
160
- //# sourceMappingURL=docker-compose-environment.js.map
@@ -4,4 +4,3 @@ exports.DownedDockerComposeEnvironment = void 0;
4
4
  class DownedDockerComposeEnvironment {
5
5
  }
6
6
  exports.DownedDockerComposeEnvironment = DownedDockerComposeEnvironment;
7
- //# sourceMappingURL=downed-docker-compose-environment.js.map
@@ -37,4 +37,3 @@ class StartedDockerComposeEnvironment {
37
37
  }
38
38
  }
39
39
  exports.StartedDockerComposeEnvironment = StartedDockerComposeEnvironment;
40
- //# sourceMappingURL=started-docker-compose-environment.js.map
@@ -16,4 +16,3 @@ class StoppedDockerComposeEnvironment {
16
16
  }
17
17
  }
18
18
  exports.StoppedDockerComposeEnvironment = StoppedDockerComposeEnvironment;
19
- //# sourceMappingURL=stopped-docker-compose-environment.js.map
@@ -1,6 +1,6 @@
1
1
  import { Readable } from "stream";
2
2
  import { RestartOptions, StartedTestContainer, StopOptions, StoppedTestContainer } from "../test-container";
3
- import { CommitOptions, ContentToCopy, DirectoryToCopy, ExecOptions, ExecResult, FileToCopy, Labels } from "../types";
3
+ import { CommitOptions, ContentToCopy, CopyToContainerOptions, DirectoryToCopy, ExecOptions, ExecResult, FileToCopy, Labels } from "../types";
4
4
  export declare class AbstractStartedContainer implements StartedTestContainer {
5
5
  protected readonly startedTestContainer: StartedTestContainer;
6
6
  constructor(startedTestContainer: StartedTestContainer);
@@ -23,7 +23,7 @@ export declare class AbstractStartedContainer implements StartedTestContainer {
23
23
  copyFilesToContainer(filesToCopy: FileToCopy[]): Promise<void>;
24
24
  copyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): Promise<void>;
25
25
  copyContentToContainer(contentsToCopy: ContentToCopy[]): Promise<void>;
26
- copyArchiveToContainer(tar: Readable, target?: string): Promise<void>;
26
+ copyArchiveToContainer(tar: Readable, target?: string, options?: CopyToContainerOptions): Promise<void>;
27
27
  copyArchiveFromContainer(path: string): Promise<NodeJS.ReadableStream>;
28
28
  exec(command: string | string[], opts?: Partial<ExecOptions>): Promise<ExecResult>;
29
29
  logs(opts?: {
@@ -64,8 +64,8 @@ class AbstractStartedContainer {
64
64
  async copyContentToContainer(contentsToCopy) {
65
65
  return this.startedTestContainer.copyContentToContainer(contentsToCopy);
66
66
  }
67
- copyArchiveToContainer(tar, target = "/") {
68
- return this.startedTestContainer.copyArchiveToContainer(tar, target);
67
+ copyArchiveToContainer(tar, target = "/", options) {
68
+ return this.startedTestContainer.copyArchiveToContainer(tar, target, options);
69
69
  }
70
70
  copyArchiveFromContainer(path) {
71
71
  return this.startedTestContainer.copyArchiveFromContainer(path);
@@ -81,4 +81,3 @@ class AbstractStartedContainer {
81
81
  }
82
82
  }
83
83
  exports.AbstractStartedContainer = AbstractStartedContainer;
84
- //# sourceMappingURL=abstract-started-container.js.map
@@ -14,4 +14,3 @@ class AbstractStoppedContainer {
14
14
  }
15
15
  }
16
16
  exports.AbstractStoppedContainer = AbstractStoppedContainer;
17
- //# sourceMappingURL=abstract-stopped-container.js.map
@@ -99,4 +99,3 @@ class GenericContainerBuilder {
99
99
  }
100
100
  }
101
101
  exports.GenericContainerBuilder = GenericContainerBuilder;
102
- //# sourceMappingURL=generic-container-builder.js.map
@@ -3,7 +3,7 @@ import { Readable } from "stream";
3
3
  import { ImageName } from "../container-runtime";
4
4
  import { StartedNetwork } from "../network/network";
5
5
  import { StartedTestContainer, TestContainer } from "../test-container";
6
- import { ArchiveToCopy, BindMount, ContentToCopy, DirectoryToCopy, Environment, ExtraHost, FileToCopy, HealthCheck, InspectResult, Labels, ResourcesQuota, TmpFs, Ulimits } from "../types";
6
+ import { ArchiveToCopy, BindMount, ContentToCopy, CopyToContainerOptions, DirectoryToCopy, Environment, ExtraHost, FileToCopy, HealthCheck, InspectResult, Labels, ResourcesQuota, TmpFs, Ulimits } from "../types";
7
7
  import { PortWithOptionalBinding } from "../utils/port";
8
8
  import { ImagePullPolicy } from "../utils/pull-policy";
9
9
  import { WaitStrategy } from "../wait-strategies/wait-strategy";
@@ -27,6 +27,7 @@ export declare class GenericContainer implements TestContainer {
27
27
  protected directoriesToCopy: DirectoryToCopy[];
28
28
  protected contentsToCopy: ContentToCopy[];
29
29
  protected archivesToCopy: ArchiveToCopy[];
30
+ protected copyToContainerOptions: CopyToContainerOptions;
30
31
  protected healthCheck?: HealthCheck;
31
32
  constructor(image: string);
32
33
  private isHelperContainer;
@@ -49,6 +50,7 @@ export declare class GenericContainer implements TestContainer {
49
50
  withPlatform(platform: string): this;
50
51
  withTmpFs(tmpFs: TmpFs): this;
51
52
  withUlimits(ulimits: Ulimits): this;
53
+ withSecurityOpt(...securityOptions: string[]): this;
52
54
  withAddedCapabilities(...capabilities: string[]): this;
53
55
  withDroppedCapabilities(...capabilities: string[]): this;
54
56
  withNetwork(network: StartedNetwork): this;
@@ -71,6 +73,7 @@ export declare class GenericContainer implements TestContainer {
71
73
  withCopyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): this;
72
74
  withCopyContentToContainer(contentsToCopy: ContentToCopy[]): this;
73
75
  withCopyArchivesToContainer(archivesToCopy: ArchiveToCopy[]): this;
76
+ withCopyToContainerOptions(copyToContainerOptions: CopyToContainerOptions): this;
74
77
  withWorkingDir(workingDir: string): this;
75
78
  withResourcesQuota({ memory, cpu }: ResourcesQuota): this;
76
79
  withSharedMemorySize(bytes: number): this;